提交 e8452cfc 编写于 作者: J Johan Hovold 提交者: Yang Yingliang

r8152: add missing endpoint sanity check

[ Upstream commit 86f3f4cd53707ceeec079b83205c8d3c756eca93 ]

Add missing endpoint sanity check to probe in order to prevent a
NULL-pointer dereference (or slab out-of-bounds access) when retrieving
the interrupt-endpoint bInterval on ndo_open() in case a device lacks
the expected endpoints.

Fixes: 40a82917 ("net/usb/r8152: enable interrupt transfer")
Cc: hayeswang <hayeswang@realtek.com>
Signed-off-by: NJohan Hovold <johan@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3c5a3132
...@@ -5167,6 +5167,9 @@ static int rtl8152_probe(struct usb_interface *intf, ...@@ -5167,6 +5167,9 @@ static int rtl8152_probe(struct usb_interface *intf,
return -ENODEV; return -ENODEV;
} }
if (intf->cur_altsetting->desc.bNumEndpoints < 3)
return -ENODEV;
usb_reset_device(udev); usb_reset_device(udev);
netdev = alloc_etherdev(sizeof(struct r8152)); netdev = alloc_etherdev(sizeof(struct r8152));
if (!netdev) { if (!netdev) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册