Commit 16b45fdf authored by Oliver Neukum's avatar Oliver Neukum Committed by Sarah Sharp

xhci: fix integer overflow

xhci_service_interval_to_ns() returns long long
to avoid an overflow. However, the type cast happens
too late. The fix is to force ULL from the beginning.

This patch should be backported to kernels as old as 3.5, that contain
the commit e3567d2c "xhci: Add Intel
U1/U2 timeout policy."
Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
CC: stable@vger.kernel.org
parent 966e7a85
...@@ -4021,7 +4021,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) ...@@ -4021,7 +4021,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
static unsigned long long xhci_service_interval_to_ns( static unsigned long long xhci_service_interval_to_ns(
struct usb_endpoint_descriptor *desc) struct usb_endpoint_descriptor *desc)
{ {
return (1 << (desc->bInterval - 1)) * 125 * 1000; return (1ULL << (desc->bInterval - 1)) * 125 * 1000;
} }
static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment