Commit fc401e69 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by Greg Kroah-Hartman
Browse files

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: default avatarPete Zaitcev <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 7b5cd5fe
...@@ -345,16 +345,17 @@ static int usblp_check_status(struct usblp *usblp, int err) ...@@ -345,16 +345,17 @@ static int usblp_check_status(struct usblp *usblp, int err)
unsigned char status, newerr = 0; unsigned char status, newerr = 0;
int error; int error;
error = usblp_read_status (usblp, usblp->statusbuf); mutex_lock(&usblp->mut);
if (error < 0) { if ((error = usblp_read_status(usblp, usblp->statusbuf)) < 0) {
if (printk_ratelimit()) if (printk_ratelimit())
printk(KERN_ERR printk(KERN_ERR
"usblp%d: error %d reading printer status\n", "usblp%d: error %d reading printer status\n",
usblp->minor, error); usblp->minor, error);
return 0; return 0;
} }
status = *usblp->statusbuf; status = *usblp->statusbuf;
if (~status & LP_PERRORP) if (~status & LP_PERRORP)
newerr = 3; newerr = 3;
Supports Markdown
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