Commit c78d1ecf authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: yurex: fix race between probe() and read()

There's a window during which read() would return 0 instead
of a correct error for no data yet. Reorder initialization
to fix the race.
Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 552e1f26
...@@ -296,6 +296,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ ...@@ -296,6 +296,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
/* save our data pointer in this interface device */ /* save our data pointer in this interface device */
usb_set_intfdata(interface, dev); usb_set_intfdata(interface, dev);
dev->bbu = -1;
/* we can register the device now, as it is ready */ /* we can register the device now, as it is ready */
retval = usb_register_dev(interface, &yurex_class); retval = usb_register_dev(interface, &yurex_class);
...@@ -306,8 +307,6 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ ...@@ -306,8 +307,6 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
goto error; goto error;
} }
dev->bbu = -1;
dev_info(&interface->dev, dev_info(&interface->dev,
"USB YUREX device now attached to Yurex #%d\n", "USB YUREX device now attached to Yurex #%d\n",
interface->minor); interface->minor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment