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] [thread-next>] [day] [month] [year] [list]
Message-ID: <18454.40816.524759.863861@notabene.brown>
Date:	Tue, 29 Apr 2008 14:09:20 +1000
From:	Neil Brown <neilb@...e.de>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
	Dan Williams <dan.j.williams@...el.com>
Subject: Re: [PATCH 007 of 9] md: prevent duplicates in bind_rdev_to_array

On Monday April 28, akpm@...ux-foundation.org wrote:
> On Tue, 29 Apr 2008 13:35:27 +1000 NeilBrown <neilb@...e.de> wrote:
> 
> > 
> > From: Dan Williams <dan.j.williams@...el.com>
> > 
> > Found when trying to reassemble an active externally managed array.
> > Without this check we hit the more noisy "sysfs duplicate" warning in
> > the later call to kobject_add.
> > 
> > Signed-off-by: Dan Williams <dan.j.williams@...el.com>
> > Signed-off-by: Neil Brown <neilb@...e.de>
> > 
> > ### Diffstat output
> >  ./drivers/md/md.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff .prev/drivers/md/md.c ./drivers/md/md.c
> > --- .prev/drivers/md/md.c	2008-04-29 12:27:57.000000000 +1000
> > +++ ./drivers/md/md.c	2008-04-29 12:27:57.000000000 +1000
> > @@ -1369,6 +1369,11 @@ static int bind_rdev_to_array(mdk_rdev_t
> >  		MD_BUG();
> >  		return -EINVAL;
> >  	}
> > +
> > +	/* prevent duplicates */
> > +	if (find_rdev(mddev, rdev->bdev->bd_dev))
> > +		return -EEXIST;
> > +
> >  	/* make sure rdev->size exceeds mddev->size */
> >  	if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) {
> >  		if (mddev->pers) {
> 
> Smells racy.  Do we have enough locking in place here to make this more
> than a best-effort thing?


Yes.  We have exclusive access to the mddev at this point, so no race.

NeilBrown
--
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