Only one patch for improving port index calculation for chipidea driver, no big changes.
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEDaZUZmFxRG/wNThrSFkpgVDWcbsFAmEoGOUACgkQSFkpgVDW cbvhVgf8DwIrSI2cie5t8pkRlOCUTpIdz0zcWjhygw1+wuz48X6fsArFbhqNOOsx 5ZoAQVp6BPRKTLwssV/5Q0rTXr4zVtra4J3QEMcswvZ2VPlGJY79LMNrhUwv096p O7fG1zgZMwxpnOF9d6E6GCZbTgJts0n72uy9qckm+lKRRFnzNKDvA76y22lacflT l6HXnYI9k+B5TU6TFQoxTJzm048a4qJ+5ROqMIigufazS9Y9mLVx4jiTK1zBRrwa nStKlfSwCFVwLbFS6NrijI8oiLxqla2YOQ9lMr+rQny58CG/qReQeUYS9h2NvjcS cseyHLz5dVG4jnc8LaQ0UAXvZOskqg== =FPB9 -----END PGP SIGNATURE----- Merge tag 'usb-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next Peter writes: Only one patch for improving port index calculation for chipidea driver, no big changes. * tag 'usb-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb: usb: chipidea: host: fix port index underflow and UBSAN complains
This commit is contained in:
commit
452d1ea55c
|
@ -240,15 +240,18 @@ static int ci_ehci_hub_control(
|
|||
)
|
||||
{
|
||||
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
|
||||
unsigned int ports = HCS_N_PORTS(ehci->hcs_params);
|
||||
u32 __iomem *status_reg;
|
||||
u32 temp;
|
||||
u32 temp, port_index;
|
||||
unsigned long flags;
|
||||
int retval = 0;
|
||||
bool done = false;
|
||||
struct device *dev = hcd->self.controller;
|
||||
struct ci_hdrc *ci = dev_get_drvdata(dev);
|
||||
|
||||
status_reg = &ehci->regs->port_status[(wIndex & 0xff) - 1];
|
||||
port_index = wIndex & 0xff;
|
||||
port_index -= (port_index > 0);
|
||||
status_reg = &ehci->regs->port_status[port_index];
|
||||
|
||||
spin_lock_irqsave(&ehci->lock, flags);
|
||||
|
||||
|
@ -260,6 +263,11 @@ static int ci_ehci_hub_control(
|
|||
}
|
||||
|
||||
if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) {
|
||||
if (!wIndex || wIndex > ports) {
|
||||
retval = -EPIPE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
temp = ehci_readl(ehci, status_reg);
|
||||
if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) {
|
||||
retval = -EPIPE;
|
||||
|
@ -288,7 +296,7 @@ static int ci_ehci_hub_control(
|
|||
ehci_writel(ehci, temp, status_reg);
|
||||
}
|
||||
|
||||
set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
|
||||
set_bit(port_index, &ehci->suspended_ports);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue