From owner-svn-src-head@FreeBSD.ORG Sun Nov 6 05:24:54 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1FEB1065672; Sun, 6 Nov 2011 05:24:54 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1EFE8FC15; Sun, 6 Nov 2011 05:24:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA65OsDW000844; Sun, 6 Nov 2011 05:24:54 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA65OsVj000842; Sun, 6 Nov 2011 05:24:54 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201111060524.pA65OsVj000842@svn.freebsd.org> From: Max Khon Date: Sun, 6 Nov 2011 05:24:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227132 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2011 05:24:55 -0000 Author: fjoe Date: Sun Nov 6 05:24:54 2011 New Revision: 227132 URL: http://svn.freebsd.org/changeset/base/227132 Log: - Fix potential double mbuf free: M_PREPEND may free mbuf chain and return NULL but item will still have the reference ot the mbuf chain and will free it upon destruction. - Fix memory leak (unfree'd item on error path). Modified: head/sys/netgraph/ng_atmllc.c Modified: head/sys/netgraph/ng_atmllc.c ============================================================================== --- head/sys/netgraph/ng_atmllc.c Sun Nov 6 05:23:42 2011 (r227131) +++ head/sys/netgraph/ng_atmllc.c Sun Nov 6 05:24:54 2011 (r227132) @@ -153,7 +153,7 @@ ng_atmllc_rcvdata(hook_p hook, item_p it int error; priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - m = NGI_M(item); + NGI_GET_M(item, m); outhook = NULL; padding = 0; @@ -170,6 +170,7 @@ ng_atmllc_rcvdata(hook_p hook, item_p it if (m->m_len < sizeof(struct atmllc) + ETHER_HDR_LEN) { m = m_pullup(m, sizeof(struct atmllc) + ETHER_HDR_LEN); if (m == NULL) { + NG_FREE_ITEM(item); return (ENOMEM); } } @@ -236,6 +237,7 @@ ng_atmllc_rcvdata(hook_p hook, item_p it } if (outhook == NULL) { + NG_FREE_M(m); NG_FREE_ITEM(item); return (0); }