mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
UPSTREAM: Input: pegasus-notetaker - check pipe type when probing
commitb3d80fd27aupstream. Fix WARNING in pegasus_open/usb_submit_urb Syzbot bug: https://syzkaller.appspot.com/bug?id=bbc107584dcf3262253ce93183e51f3612aaeb13 Warning raised because pegasus_driver submits transfer request for bogus URB (pipe type does not match endpoint type). Add sanity check at probe time for pipe value extracted from endpoint descriptor. Probe will fail if sanity check fails. Reported-and-tested-by: syzbot+04ee0cb4caccaed12d78@syzkaller.appspotmail.com Change-Id: Iedb606676db9329b44bc530edf017c80f4fa4263 Signed-off-by: Soumya Negi <soumya.negi97@gmail.com> Link: https://lore.kernel.org/r/20230404074145.11523-1-soumya.negi97@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit342c1db4fa) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
6bf110bb7a
commit
690f3e949d
@@ -296,6 +296,12 @@ static int pegasus_probe(struct usb_interface *intf,
|
||||
pegasus->intf = intf;
|
||||
|
||||
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
|
||||
/* Sanity check that pipe's type matches endpoint's type */
|
||||
if (usb_pipe_type_check(dev, pipe)) {
|
||||
error = -EINVAL;
|
||||
goto err_free_mem;
|
||||
}
|
||||
|
||||
pegasus->data_len = usb_maxpacket(dev, pipe);
|
||||
|
||||
pegasus->data = usb_alloc_coherent(dev, pegasus->data_len, GFP_KERNEL,
|
||||
|
||||
Reference in New Issue
Block a user