1
0
Fork 0

usblp: fix race between disconnect() and read()

commit 9cdabcb3ef 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5.4-rM2-2.2.x-imx-squashed
Oliver Neukum 2020-09-17 12:34:27 +02:00 committed by Greg Kroah-Hartman
parent 56ad2cab08
commit 6c56942bd2
1 changed files with 5 additions and 0 deletions

View File

@ -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);