Re: [PATCH] USB: serial: fix race between probe and open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 16, 2012 at 12:54:29PM -0400, Alan Stern wrote:
> On Fri, 16 Mar 2012, Johan Hovold wrote:
> 
> > Fix race between probe and open by making sure that the disconnected
> > flag is not cleared until all ports have been registered and the serial
> > struct is fully initialised.
> > 
> > A call to tty_open while probe is running may get a reference to the
> > serial structure in serial_install before its ports have been
> > registered. This may lead to usb_serial_core calling driver open before
> > port is fully initialised.
> 
> Are you sure that is really the problem?  It doesn't seem to make sense
> -- before a port has been registered there should be no device file to
> open.

Yes, I am _and_ you are right -- I needed to create a persistent device
node using mknod in my setup in order to trigger it. I'm not sure what
Ken's setup is like, but on a system with static device nodes the race
is easily triggered.
 
> > @@ -1088,6 +1094,7 @@ int usb_serial_probe(struct usb_interface *interface,
> >  exit:
> >  	/* success */
> >  	usb_set_intfdata(interface, serial);
> > +	serial->disconnected = 0;
> >  	module_put(type->driver.owner);
> >  	return 0;
> 
> On the other hand, it certainly seems like a good idea to move this
> usb_set_intfdata() call above the loop where the ports are registered.

Ok.

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux