[openib-general] Re: [PATCH 9 of 20] ipath - char devices for diagnostics and lightweight subnet management

Roland Dreier rdreier at cisco.com
Thu Mar 9 15:24:13 PST 2006


 > +static int ipath_sma_open(struct inode *in, struct file *fp)
 > +{
 > +	int s;
 > +
 > +	if (ipath_sma_alive) {
 > +		ipath_dbg("SMA already running (pid %u), failing\n",
 > +			  ipath_sma_alive);
 > +		return -EBUSY;
 > +	}
 > +
 > +	for (s = 0; s < atomic_read(&ipath_max); s++) {
 > +		struct ipath_devdata *dd = ipath_lookup(s);
 > +		/* we need at least one infinipath device to be initialized. */
 > +		if (dd && dd->ipath_flags & IPATH_INITTED) {
 > +			ipath_sma_alive = current->pid;

It seems there's a window here where two processes can both pass the
if (ipath_sma_alive) test and then proceed to step on each other.

 - R.



More information about the general mailing list