Commit 65525984 authored by Sven Schnelle's avatar Sven Schnelle Committed by Willy Tarreau

USB: CDC ACM: Fix NULL pointer dereference

commit 99f347ca upstream.

If a device specifies zero endpoints in its interface descriptor,
the kernel oopses in acm_probe(). Even though that's clearly an
invalid descriptor, we should test wether we have all endpoints.
This is especially bad as this oops can be triggered by just
plugging a USB device in.
Signed-off-by: default avatarSven Schnelle <svens@stackframe.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 80bc5ec1
...@@ -1120,7 +1120,8 @@ static int acm_probe(struct usb_interface *intf, ...@@ -1120,7 +1120,8 @@ static int acm_probe(struct usb_interface *intf,
} }
if (data_interface->cur_altsetting->desc.bNumEndpoints < 2) if (data_interface->cur_altsetting->desc.bNumEndpoints < 2 ||
control_interface->cur_altsetting->desc.bNumEndpoints == 0)
return -EINVAL; return -EINVAL;
epctrl = &control_interface->cur_altsetting->endpoint[0].desc; epctrl = &control_interface->cur_altsetting->endpoint[0].desc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment