Skip to content

Commit faaff97

Browse files
rustylifegregkh
authored andcommitted
staging: wlan-ng: properly check endpoint types
As syzkaller detected, wlan-ng driver does not do sanity check of endpoints in prism2sta_probe_usb(), add check for xfer direction and type Reported-and-tested-by: [email protected] Link: https://syzkaller.appspot.com/bug?extid=c2a1fa67c02faa0de723 Signed-off-by: Rustam Kovhaev <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 926234f commit faaff97

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/staging/wlan-ng/prism2usb.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,25 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
6161
const struct usb_device_id *id)
6262
{
6363
struct usb_device *dev;
64-
64+
const struct usb_endpoint_descriptor *epd;
65+
const struct usb_host_interface *iface_desc = interface->cur_altsetting;
6566
struct wlandevice *wlandev = NULL;
6667
struct hfa384x *hw = NULL;
6768
int result = 0;
6869

70+
if (iface_desc->desc.bNumEndpoints != 2) {
71+
result = -ENODEV;
72+
goto failed;
73+
}
74+
75+
result = -EINVAL;
76+
epd = &iface_desc->endpoint[1].desc;
77+
if (!usb_endpoint_is_bulk_in(epd))
78+
goto failed;
79+
epd = &iface_desc->endpoint[2].desc;
80+
if (!usb_endpoint_is_bulk_out(epd))
81+
goto failed;
82+
6983
dev = interface_to_usbdev(interface);
7084
wlandev = create_wlan();
7185
if (!wlandev) {

0 commit comments

Comments
 (0)