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

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

 



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.

> @@ -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.

Alan Stern


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