Skip to content

Commit

Permalink
USB: yurex: fix race between probe() and read()
Browse files Browse the repository at this point in the history
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: Oliver Neukum <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Oliver Neukum authored and gregkh committed May 27, 2014
1 parent 552e1f2 commit c78d1ec
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/misc/yurex.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_

/* save our data pointer in this interface device */
usb_set_intfdata(interface, dev);
dev->bbu = -1;

/* we can register the device now, as it is ready */
retval = usb_register_dev(interface, &yurex_class);
Expand All @@ -306,8 +307,6 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
goto error;
}

dev->bbu = -1;

dev_info(&interface->dev,
"USB YUREX device now attached to Yurex #%d\n",
interface->minor);
Expand Down

0 comments on commit c78d1ec

Please sign in to comment.