lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <18093.42229.134557.618117@notabene.brown>
Date:	Mon, 30 Jul 2007 18:44:37 +1000
From:	Neil Brown <neilb@...e.de>
To:	Maik Hampel <m.hampel@....de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-raid@...r.kernel.org" <linux-raid@...r.kernel.org>
Subject: Re: md: raid10: fix use-after-free of bio

On Monday July 30, m.hampel@....de wrote:
> > 
> > Surely we just leaked that bio if (mirror == -1)?
> > 
> > better:
> > 
> > --- a/drivers/md/raid10.c~md-raid10-fix-use-after-free-of-bio
> > +++ a/drivers/md/raid10.c
> > @@ -1534,7 +1534,6 @@ static void raid10d(mddev_t *mddev)
> >  			bio = r10_bio->devs[r10_bio->read_slot].bio;
> >  			r10_bio->devs[r10_bio->read_slot].bio =
> >  				mddev->ro ? IO_BLOCKED : NULL;
> > -			bio_put(bio);
> >  			mirror = read_balance(conf, r10_bio);
> >  			if (mirror == -1) {
> >  				printk(KERN_ALERT "raid10: %s: unrecoverable I/O"
> > @@ -1542,8 +1541,10 @@ static void raid10d(mddev_t *mddev)
> >  				       bdevname(bio->bi_bdev,b),
> >  				       (unsigned long long)r10_bio->sector);
> >  				raid_end_bio_io(r10_bio);
> > +				bio_put(bio);
> raid_end_bio_io() calls put_all_bios(), which does a bio_put() to
> corresponding r10_bio->devs[i]. So this looks like redundant code for
> me.

Yes, but note above that this bio for this slot has been set to
'NULL', so put_all_bios won't find anything to call bio_put on.

Thanks,
NeilBrown


> >  			} else {
> >  				const int do_sync = bio_sync(r10_bio->master_bio);
> > +				bio_put(bio);
> >  				rdev = conf->mirrors[mirror].rdev;
> >  				if (printk_ratelimit())
> >  					printk(KERN_ERR "raid10: %s: redirecting sector %llu to"
> 
> Regards, 
> Maik Hampel
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ