提交 048e6145 编写于 作者: T Thinh Nguyen 提交者: Zheng Zengkai

usb: xhci: Fix port minor revision

stable inclusion
from stable-5.10.36
commit 173ab4bb8cbf896894769fed5d2c3dcfd0cbd75e
bugzilla: 51867
CVE: NA

--------------------------------

[ Upstream commit 64364bc9 ]

Some hosts incorrectly use sub-minor version for minor version (i.e.
0x02 instead of 0x20 for bcdUSB 0x320 and 0x01 for bcdUSB 0x310).
Currently the xHCI driver works around this by just checking for minor
revision > 0x01 for USB 3.1 everywhere. With the addition of USB 3.2,
checking this gets a bit cumbersome. Since there is no USB release with
bcdUSB 0x301 to 0x309, we can assume that sub-minor version 01 to 09 is
incorrect. Let's try to fix this and use the minor revision that matches
with the USB/xHCI spec to help with the version checking within the
driver.
Acked-by: NMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: NThinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/ed330e95a19dc367819c5b4d78bf7a541c35aa0a.1615432770.git.Thinh.Nguyen@synopsys.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b5cf0984
......@@ -2143,6 +2143,15 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
if (major_revision == 0x03) {
rhub = &xhci->usb3_rhub;
/*
* Some hosts incorrectly use sub-minor version for minor
* version (i.e. 0x02 instead of 0x20 for bcdUSB 0x320 and 0x01
* for bcdUSB 0x310). Since there is no USB release with sub
* minor version 0x301 to 0x309, we can assume that they are
* incorrect and fix it here.
*/
if (minor_revision > 0x00 && minor_revision < 0x10)
minor_revision <<= 4;
} else if (major_revision <= 0x02) {
rhub = &xhci->usb2_rhub;
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册