There will be gadget driver unregister twice in USB secure
when try to set the UDC to none from userspace, which will cause
kernel panic in 4.9 kernel version, as there is a feature
about pending gadget driver list being added in this version.
As a solution, make sure gadget driver unregister or probe only
once over secure mode entry or usb configure from userspace.
Kernel BUG at
ffffff8093067140 [verbose debug info unavailable]
Internal error: Accessing user space memory outside uaccess.h
Change-Id: I89f03afbf9716a95aae37e354cc0cb293b2ea090
Signed-off-by: a17671 <a17671@motorola.com>
Reviewed-on: https://gerrit.mot.com/
1376192
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
if (!gi->composite.gadget_driver.udc_name)
return -ENODEV;
+ if (gi->secure) {
+ kfree(gi->composite.gadget_driver.udc_name);
+ gi->composite.gadget_driver.udc_name = NULL;
+ return 0;
+ }
+
ret = usb_gadget_unregister_driver(&gi->composite.gadget_driver);
if (ret)
return ret;