projects
/
wrapfs-3.2.y.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f85eb15
)
usblp: fix race between disconnect() and read()
author
Oliver Neukum
<oneukum@suse.com>
Thu, 17 Sep 2020 10:34:27 +0000
(12:34 +0200)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 23 Sep 2020 10:59:59 +0000
(12:59 +0200)
commit
9cdabcb3ef8c24ca3a456e4db7b012befb688e73
upstream.
read() needs to check whether the device has been
disconnected before it tries to talk to the device.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reported-by: syzbot+be5b5f86a162a6c281e6@syzkaller.appspotmail.com
Link:
https://lore.kernel.org/r/20200917103427.15740-1-oneukum@suse.com
Cc: stable <stable@vger.kernel.org>
drivers/usb/class/usblp.c
patch
|
blob
|
history
diff --git
a/drivers/usb/class/usblp.c
b/drivers/usb/class/usblp.c
index 084c48c5848fc90354216254ffbd48c17a7be030..67cbd42421bee7e5776659a5f7ebfb077564a457 100644
(file)
--- a/
drivers/usb/class/usblp.c
+++ b/
drivers/usb/class/usblp.c
@@
-827,6
+827,11
@@
static ssize_t usblp_read(struct file *file, char __user *buffer, size_t len, lo
if (rv < 0)
return rv;
+ if (!usblp->present) {
+ count = -ENODEV;
+ goto done;
+ }
+
if ((avail = usblp->rstatus) < 0) {
printk(KERN_ERR "usblp%d: error %d reading from printer\n",
usblp->minor, (int)avail);