Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>

authored by

Oliver Neukum and committed by
Greg Kroah-Hartman
9cdabcb3 29231826

+5
+5
drivers/usb/class/usblp.c
··· 827 827 if (rv < 0) 828 828 return rv; 829 829 830 + if (!usblp->present) { 831 + count = -ENODEV; 832 + goto done; 833 + } 834 + 830 835 if ((avail = usblp->rstatus) < 0) { 831 836 printk(KERN_ERR "usblp%d: error %d reading from printer\n", 832 837 usblp->minor, (int)avail);