[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_15DD79B42AD8A0D64A7CDC24D4FE6C85800A@qq.com>
Date: Mon, 26 Jun 2023 00:42:18 +0800
From: Zhang Shurong <zhang_shurong@...mail.com>
To: jgross@...e.com
Cc: gregkh@...uxfoundation.org, xen-devel@...ts.xenproject.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Zhang Shurong <zhang_shurong@...mail.com>
Subject: [PATCH] xen: fix potential shift out-of-bounds in xenhcd_hub_control()
Fix potential shift out-of-bounds in xenhcd_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/xen-hcd.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/xen-hcd.c b/drivers/usb/host/xen-hcd.c
index 46fdab940092..c0e7207d3857 100644
--- a/drivers/usb/host/xen-hcd.c
+++ b/drivers/usb/host/xen-hcd.c
@@ -456,6 +456,8 @@ static int xenhcd_hub_control(struct usb_hcd *hcd, __u16 typeReq, __u16 wValue,
info->ports[wIndex - 1].c_connection = false;
fallthrough;
default:
+ if (wValue >= 32)
+ goto error;
info->ports[wIndex - 1].status &= ~(1 << wValue);
break;
}
@@ -527,6 +529,8 @@ static int xenhcd_hub_control(struct usb_hcd *hcd, __u16 typeReq, __u16 wValue,
xenhcd_rhport_suspend(info, wIndex);
break;
default:
+ if (wValue >= 32)
+ goto error;
if (info->ports[wIndex-1].status & USB_PORT_STAT_POWER)
info->ports[wIndex-1].status |= (1 << wValue);
}
--
2.41.0
Powered by blists - more mailing lists