Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 2008 10:42:47 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        Doug Rabson <dfr@rabson.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Paul Saab <ps@freebsd.org>
Subject:   Re: svn commit: r185902 - head/sys/boot/zfs
Message-ID:  <200812111042.48029.jhb@freebsd.org>
In-Reply-To: <25FCC66F-902B-49AF-9B9C-07AE3446B13B@rabson.org>
References:  <200812110223.mBB2NnjW049843@svn.freebsd.org> <25FCC66F-902B-49AF-9B9C-07AE3446B13B@rabson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812111042.48029.jhb>