[PATCH 4.19 31/81] USB: microtek: fix info-leak at probe

From: Greg Kroah-Hartman
Date: Wed Oct 16 2019 - 18:10:40 EST


From: Johan Hovold <johan@xxxxxxxxxx>

commit 177238c3d47d54b2ed8f0da7a4290db492f4a057 upstream.

Add missing bulk-in endpoint sanity check to prevent uninitialised stack
data from being reported to the system log and used as endpoint
addresses.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@xxxxxxxxxxxxxxx>
Reported-by: syzbot+5630ca7c3b2be5c9da5e@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
Acked-by: Oliver Neukum <oneukum@xxxxxxxx>
Link: https://lore.kernel.org/r/20191003070931.17009-1-johan@xxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/usb/image/microtek.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -721,6 +721,10 @@ static int mts_usb_probe(struct usb_inte

}

+ if (ep_in_current != &ep_in_set[2]) {
+ MTS_WARNING("couldn't find two input bulk endpoints. Bailing out.\n");
+ return -ENODEV;
+ }

if ( ep_out == -1 ) {
MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" );