[illumos-Developer] webrev: 1282 nsmb_open has a race

Garrett D'Amore garrett at damore.org
Wed Jul 27 14:02:05 PDT 2011


On Wed, 2011-07-27 at 15:38 -0400, Gordon Ross wrote:
> Please review:  Relatively simple bug found by inspection.
>   http://www.yalms.org/cr/illumos-1282/
> 
> Also cleaned up nsmb_attach, which had inherited some code
> from nfs to make minor unit zero busy.  Completely unnecessary.
> and a minor nit about getinfo...
> 
> While I haven't seen this race cause damage, I'm a little worried
> that my prior changes in 1121 could make this more exposed.

Instead of 
 279         case DDI_INFO_DEVT2INSTANCE:
 280                 *result = NULL;

I would prefer *result = nsmb_dip ? ddi_get_instance(nsmb_dip) : NULL;

Better yet, why not simply decode the minor number, like this:

	ddi_get_minor(dev);

(On that note, using soft state, like you had before, but dereferencing
the soft state by minor number, seems like the more clean solution,
rather than relying on the only one instance rule.)

	- Garrett

> 
> Thanks,
> Gordon
> 
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer





More information about the Developer mailing list