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

[PATCH] tiny race with devfs in printer

USB printer bugfix

looking through printer.c in preparation for shifting devfs
support to usbcore I noticed that printer advertises a device
through devfs before it can be opened.
As devfs, or more precisely devfsd can be used to trigger actions
this matters and is wrong.
parent 4bc91a02
...@@ -871,6 +871,9 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum, ...@@ -871,6 +871,9 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
usblp_check_status(usblp, 0); usblp_check_status(usblp, 0);
#endif #endif
/* add a table entry so the device works when advertised */
usblp_table[usblp->minor] = usblp;
/* If we have devfs, create with perms=660. */ /* If we have devfs, create with perms=660. */
sprintf(name, "lp%d", usblp->minor); sprintf(name, "lp%d", usblp->minor);
usblp->devfs = devfs_register(usb_devfs_handle, name, usblp->devfs = devfs_register(usb_devfs_handle, name,
...@@ -886,7 +889,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum, ...@@ -886,7 +889,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
usblp->current_protocol, usblp->dev->descriptor.idVendor, usblp->current_protocol, usblp->dev->descriptor.idVendor,
usblp->dev->descriptor.idProduct); usblp->dev->descriptor.idProduct);
return usblp_table[usblp->minor] = usblp; return usblp;
abort: abort:
if (usblp) { if (usblp) {
......
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