[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_D1B05B6060451EA10A64A88E122E37EDB508@qq.com>
Date: Mon, 26 Jun 2023 01:12:13 +0800
From: Zhang Shurong <zhang_shurong@...mail.com>
To: gregkh@...uxfoundation.org
Cc: mark.tomlinson@...iedtelesis.co.nz, krzysztof.kozlowski@...aro.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Zhang Shurong <zhang_shurong@...mail.com>
Subject: [PATCH] usb: max-3421: fix potential shift out-of-bounds in max3421_hub_control()
Fix potential shift out-of-bounds in max3421_hub_control()
ClearPortFeature handling and SetPortFeature handling.
wValue may be greater than 32 which can not be used for shifting.
similar patch:
https://patchwork.kernel.org/patch/12162547
Signed-off-by: Zhang Shurong <zhang_shurong@...mail.com>
---
drivers/usb/host/max3421-hcd.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index d152d72de126..035cd6abc2f6 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1688,6 +1688,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index,
!pdata->vbus_active_level);
fallthrough;
default:
+ if (value >= 32)
+ goto error;
max3421_hcd->port_status &= ~(1 << value);
}
break;
@@ -1741,6 +1743,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index,
max3421_reset_port(hcd);
fallthrough;
default:
+ if (value >= 32)
+ goto error;
if ((max3421_hcd->port_status & USB_PORT_STAT_POWER)
!= 0)
max3421_hcd->port_status |= (1 << value);
--
2.41.0
Powered by blists - more mailing lists