From owner-freebsd-bugs@FreeBSD.ORG Fri Apr 13 13:00:10 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 23AAE16A406 for ; Fri, 13 Apr 2007 13:00:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id DC2AA13C45B for ; Fri, 13 Apr 2007 13:00:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l3DD09Qv080790 for ; Fri, 13 Apr 2007 13:00:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l3DD09XY080780; Fri, 13 Apr 2007 13:00:09 GMT (envelope-from gnats) Resent-Date: Fri, 13 Apr 2007 13:00:09 GMT Resent-Message-Id: <200704131300.l3DD09XY080780@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Thomas Karcher Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 84B0B16A402 for ; Fri, 13 Apr 2007 12:50:03 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id 73A8313C45E for ; Fri, 13 Apr 2007 12:50:03 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l3DCo3xg095048 for ; Fri, 13 Apr 2007 12:50:03 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l3DCj2x3094100; Fri, 13 Apr 2007 12:45:02 GMT (envelope-from nobody) Message-Id: <200704131245.l3DCj2x3094100@www.freebsd.org> Date: Fri, 13 Apr 2007 12:45:02 GMT From: Thomas Karcher To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: kern/111537: [patch] ip6_input() treats mbuf cluster wrong X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2007 13:00:10 -0000 >Number: 111537 >Category: kern >Synopsis: [patch] ip6_input() treats mbuf cluster wrong >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 13 13:00:09 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Thomas Karcher >Release: RELENG_6_2_0_RELEASE >Organization: >Environment: >Description: In ip6_input() after line 294, a bunch of code takes care of copying the mbuf/mbuf cluster to a more KAME conform mbuf/mbuf cluster - but in my opinion, it does it not completely right ... In line 318, the m_copydata() call works only if the new mbuf n is "just" an mbuf and not an mbuf cluster. See the solution what I mean. >How-To-Repeat: >Fix: I think the code should look like this: 318 if (n && n->m_pkthdr.len > MHLEN) { 319 m_copydata(m, 0, n->m_pkthdr.len, n->m_ext.ext_buf); 320 n->m_data = n->m_ext.ext_buf; 321 } else { 322 m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); 323 } Please find a diff attached. Patch attached with submission follows: Index: netinet6/ip6_input.c =================================================================== --- netinet6/ip6_input.c (revision 576) +++ netinet6/ip6_input.c (working copy) @@ -315,7 +315,12 @@ return; /* ENOBUFS */ } - m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); + if (n && n->m_pkthdr.len > MHLEN) { + m_copydata(m, 0, n->m_pkthdr.len, n->m_ext.ext_buf); + n->m_data = n->m_ext.ext_buf; + } else { + m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t)); + } n->m_len = n->m_pkthdr.len; m_freem(m); m = n; >Release-Note: >Audit-Trail: >Unformatted: