diff options
author | Pete Zaitcev <zaitcev@redhat.com> | 2007-08-14 07:50:13 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 23:55:14 +0200 |
commit | fc401e697f8c00ad1178a6758e86e3881dfa3181 (patch) | |
tree | b744e6b010f646b21c6185896141252c49d91de2 /drivers/usb/class/usblp.c | |
parent | USB: SisUSB2VGA: Convert printk to dev_* macros (diff) | |
download | linux-fc401e697f8c00ad1178a6758e86e3881dfa3181.tar.xz linux-fc401e697f8c00ad1178a6758e86e3881dfa3181.zip |
usblp: mutex in usblp_check_status
Add a mutex to protect the ->statusbuf. Not really an issue, because CUPS
is single-threaded when it talks to the printer, but I feel safer this way.
This should be deadlock-free, but I kept this as a separate patch in case
someone ends running a git bisect.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/class/usblp.c')
-rw-r--r-- | drivers/usb/class/usblp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 9696668e5752..2c4a359355ba 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -345,16 +345,17 @@ static int usblp_check_status(struct usblp *usblp, int err) unsigned char status, newerr = 0; int error; - error = usblp_read_status (usblp, usblp->statusbuf); - if (error < 0) { + mutex_lock(&usblp->mut); + if ((error = usblp_read_status(usblp, usblp->statusbuf)) < 0) { + mutex_unlock(&usblp->mut); if (printk_ratelimit()) printk(KERN_ERR "usblp%d: error %d reading printer status\n", usblp->minor, error); return 0; } - status = *usblp->statusbuf; + mutex_unlock(&usblp->mut); if (~status & LP_PERRORP) newerr = 3; |