From owner-svn-src-head@FreeBSD.ORG Thu Dec 11 16:15:44 2008 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 4D94E1065749; Thu, 11 Dec 2008 16:15:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7F6428FC1D; Thu, 11 Dec 2008 16:15:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mBBGFUPo034949; Thu, 11 Dec 2008 11:15:36 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Doug Rabson Date: Thu, 11 Dec 2008 10:42:47 -0500 User-Agent: KMail/1.9.7 References: <200812110223.mBB2NnjW049843@svn.freebsd.org> <25FCC66F-902B-49AF-9B9C-07AE3446B13B@rabson.org> In-Reply-To: <25FCC66F-902B-49AF-9B9C-07AE3446B13B@rabson.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812111042.48029.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Thu, 11 Dec 2008 11:15:36 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/8746/Wed Dec 10 23:14:26 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Paul Saab Subject: Re: svn commit: r185902 - head/sys/boot/zfs 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: Thu, 11 Dec 2008 16:15:44 -0000 On Thursday 11 December 2008 08:55:32 am Doug Rabson wrote: > > On 11 Dec 2008, at 02:23, Paul Saab wrote: > > > Author: ps > > Date: Thu Dec 11 02:23:49 2008 > > New Revision: 185902 > > URL: http://svn.freebsd.org/changeset/base/185902 > > > > Log: > > Avoid a double free in devopen by not freeing the device structure > > in zfs_dev_open. This stops a panic in the loader when trying to > > read from a zfs device and no zfs devices exist. > > > > Modified: > > head/sys/boot/zfs/zfs.c > > > > Modified: head/sys/boot/zfs/zfs.c > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- head/sys/boot/zfs/zfs.c Thu Dec 11 01:41:38 2008 (r185901) > > +++ head/sys/boot/zfs/zfs.c Thu Dec 11 02:23:49 2008 (r185902) > > @@ -474,7 +474,6 @@ zfs_dev_open(struct open_file *f, ...) > > * the pool. > > */ > > unit = dev->d_unit; > > - free(dev); > > > > i = 0; > > STAILQ_FOREACH(spa, &zfs_pools, spa_link) { > > Doesn't this introduce a memory leak in the case where there is a ZFS > pool? In that case, zfs_dev_open replaces f->f_devdata with a > reference to the pool structure. Probably a better fix would be to > move the free(dev) to just before the 'return (0)' statement. Yes, that would work. -- John Baldwin