From owner-svn-src-all@FreeBSD.ORG Mon Nov 28 20:40:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58982106566B; Mon, 28 Nov 2011 20:40:02 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by mx1.freebsd.org (Postfix) with ESMTP id 075288FC08; Mon, 28 Nov 2011 20:40:01 +0000 (UTC) Received: from jh (a91-153-115-208.elisa-laajakaista.fi [91.153.115.208]) by gw02.mail.saunalahti.fi (Postfix) with SMTP id B15831395DD; Mon, 28 Nov 2011 22:23:07 +0200 (EET) Date: Mon, 28 Nov 2011 22:23:07 +0200 From: Jaakko Heinonen To: Gleb Smirnoff Message-ID: <20111128202307.GA4064@jh> References: <201111281444.pASEixdO095604@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , src-committers@freebsd.org Subject: Re: svn commit: r228071 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2011 20:40:02 -0000 On 2011-11-28, Bjoern A. Zeeb wrote: > > static void > > if_clone_free(struct if_clone *ifc) > > { > > - for (int bytoff = 0; bytoff < ifc->ifc_bmlen; bytoff++) { > > - KASSERT(ifc->ifc_units[bytoff] == 0x00, > > - ("ifc_units[%d] is not empty", bytoff)); > > - } > > > > KASSERT(LIST_EMPTY(&ifc->ifc_iflist), > > ("%s: ifc_iflist not empty", __func__)); > > > > IF_CLONE_LOCK_DESTROY(ifc); > > - free(ifc->ifc_units, M_CLONE); > > + delete_unrhdr(ifc->ifc_unrhdr); > > } delete_unrhdr() KASSERTs that all allocations has been freed. Thus if the leak below has occurred, the result will be a panic at this point with INVARIANTS enabled kernel. If INVARIANTS is disabled, a memory leak is possible. > > + snprintf(name, IFNAMSIZ, "%s%d", ifc->ifc_name, *unit); > > + if (ifunit(name) != NULL) { > > + if (wildcard) > > + goto retry; /* XXXGL: yep, it's a unit leak */ > > + else > > + return (EEXIST); -- Jaakko