aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorSergey Shtylyov <s.shtylyov@omp.ru>2022-08-23 23:53:26 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-31 09:07:52 +0200
commit4348f2e3ab3358898bfe93387ced7f3e1e3a6186 (patch)
treeea32f6d5a2bb341083815ddcd07c6feabb6faaac /drivers/usb/gadget
parentusb: chipidea: Add support for VBUS control with PHY (diff)
downloadwireguard-linux-4348f2e3ab3358898bfe93387ced7f3e1e3a6186.tar.xz
wireguard-linux-4348f2e3ab3358898bfe93387ced7f3e1e3a6186.zip
usb: gadget: function: rndis: limit # of RNDIS instances to 1000
As follows from #define NAME_TEMPLATE, the procfs code in the RNDIS driver expects the # of instances to be 3-digit decimal, while the driver calls ida_simple_get() passing 0 as the 'end' argument which results in actual max instance # of INT_MAX. Limit the maximum # of RNDIS instances to 1000 which is still a lot! :-) Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru> Link: https://lore.kernel.org/r/a8180973-3ded-3644-585a-169589a37642@omp.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/function/rndis.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c
index 10ba339bcea4..29bf8664bf58 100644
--- a/drivers/usb/gadget/function/rndis.c
+++ b/drivers/usb/gadget/function/rndis.c
@@ -869,7 +869,7 @@ EXPORT_SYMBOL_GPL(rndis_msg_parser);
static inline int rndis_get_nr(void)
{
- return ida_simple_get(&rndis_ida, 0, 0, GFP_KERNEL);
+ return ida_simple_get(&rndis_ida, 0, 1000, GFP_KERNEL);
}
static inline void rndis_put_nr(int nr)