Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wusb: make ep0_reinit available for modules

We need to be able to call ep0_reinit() [renamed to usb_ep0_reinit()]
from the WUSB security code. The reason is that when we authenticate
the device, it's address changes (from having bit 7 set to having it
cleared). Thus, we need to signal the USB stack to reinitialize EP0,
so the status with the previous address kept at the HCD layer is
cleared and properly reinitialized.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Inaky Perez-Gonzalez and committed by
Greg Kroah-Hartman
fc721f51 6c529cdc

+7 -5
+6 -5
drivers/usb/core/hub.c
··· 2211 2211 return portstatus; 2212 2212 } 2213 2213 2214 - static void ep0_reinit(struct usb_device *udev) 2214 + void usb_ep0_reinit(struct usb_device *udev) 2215 2215 { 2216 2216 usb_disable_endpoint(udev, 0 + USB_DIR_IN); 2217 2217 usb_disable_endpoint(udev, 0 + USB_DIR_OUT); 2218 2218 usb_enable_endpoint(udev, &udev->ep0); 2219 2219 } 2220 + EXPORT_SYMBOL_GPL(usb_ep0_reinit); 2220 2221 2221 2222 #define usb_sndaddr0pipe() (PIPE_CONTROL << 30) 2222 2223 #define usb_rcvaddr0pipe() ((PIPE_CONTROL << 30) | USB_DIR_IN) ··· 2238 2237 if (retval == 0) { 2239 2238 udev->devnum = devnum; /* Device now using proper address */ 2240 2239 usb_set_device_state(udev, USB_STATE_ADDRESS); 2241 - ep0_reinit(udev); 2240 + usb_ep0_reinit(udev); 2242 2241 } 2243 2242 return retval; 2244 2243 } ··· 2474 2473 } 2475 2474 dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); 2476 2475 udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); 2477 - ep0_reinit(udev); 2476 + usb_ep0_reinit(udev); 2478 2477 } 2479 2478 2480 2479 retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE); ··· 2730 2729 loop_disable: 2731 2730 hub_port_disable(hub, port1, 1); 2732 2731 loop: 2733 - ep0_reinit(udev); 2732 + usb_ep0_reinit(udev); 2734 2733 release_address(udev); 2735 2734 usb_put_dev(udev); 2736 2735 if ((status == -ENOTCONN) || (status == -ENOTSUPP)) ··· 3165 3164 3166 3165 /* ep0 maxpacket size may change; let the HCD know about it. 3167 3166 * Other endpoints will be handled by re-enumeration. */ 3168 - ep0_reinit(udev); 3167 + usb_ep0_reinit(udev); 3169 3168 ret = hub_port_init(parent_hub, udev, port1, i); 3170 3169 if (ret >= 0 || ret == -ENOTCONN || ret == -ENODEV) 3171 3170 break;
+1
drivers/usb/core/hub.h
··· 195 195 }; 196 196 197 197 extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe); 198 + extern void usb_ep0_reinit(struct usb_device *); 198 199 199 200 #endif /* __LINUX_HUB_H */