mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 05:30:52 +07:00
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>
This commit is contained in:
parent
29231826f3
commit
9cdabcb3ef
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user