usb: gadget: pxa25x_udc: fix use-before-initialized bug
PATCH RESEND 1/1 usb: gadget: pxa25x_udc: fix use-before-initialized bug
Fix use-before-initialized bug in pxa25x_udc driver.
Function usb_gadget_register_driver calls udc_disable, and udc_disable calls pullup_off that uses dev->mach->udc_command. But dev->mach is initialized in usb_gadget_register_driver after calling udc_disable. This patch fixes the order of initialization.
---
I'm resending the patch with fixed 'Signed-off-by:' and 'From:' fields. There are no changes in patch contents.
drivers/usb/gadget/pxa25x_udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/pxa25x_udc.c +2 -2
@@ -1950,11 +1950,11 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) dev->watchdog.period =5000 *CONFIG_SYS_HZ /1000000 ;/* 5 ms */ dev->watchdog.function = udc_watchdog; + dev->mach = &mach_info; +udc_disable (dev);udc_reinit (dev); - dev->mach = &mach_info; - dev->gadget.name ="pxa2xx_udc" ; retval = driver->bind (&dev->gadget);if (retval) {
Signature · 1 line
2.1.4
Marek Vasut
AppliedPATCH RESEND 1/1 usb: gadget: pxa25x_udc: fix use-before-initialized bug
Quoted 8 lines · Alex Sadovsky
Fix use-before-initialized bug in
pxa25x_udcdriver.Function
usb_gadget_register_drivercallsudc_disable, andudc_disablecallspullup_offthat usesdev->mach->udc_command. Butdev->machis initialized inusb_gadget_register_driverafter callingudc_disable. This patch fixes the order of initialization.Signed-off-by Alex Sadovsky <[email protected]>
Applied, thanks!
Best regards,
Marek Vasut