mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
usb: gadget: udc: core: fix NULL pointer dereference when handle disconnect
This patch fix NULL pointer dereference with the following log when usb gadget is configured as uvc. PC is at usb_gadget_disconnect+0x3c/0x4a LR is at dwc3_gadget_pullup+0xllb/0xl28 pc : [<b0lfa202>] lr : [<b0le67a7>] psr : 60000033 ...... [<b0lfa202>] (usb_gadget_disconnect) from [<b0lfa227>] (usb_gadget_deactivate+0xl7/0x34) [<b0lfa227>] (usb gadget-deactivate) from [<b0lf6e3b>] (usb function deactivate+0x3d/0x86) [<b0lf6e3b>] (usb_function_deactivate) from [<b0202421>](uvc_function_disconnect+0xd/0x30) [<b0202421>] (uvc_function_disconnect) from [<b0202a9b>](uvc_v412_release+0xlb/0x52) [<b0202a9b>] (uvc_v412_release) from [<b0210291>](v412_release+0x73/0x7e) [<b0210291>] (v412_release) from [<b007ea9f>] (_fput+0x43/0xc8) [<b007ea9f>] (_fput) from[<b00239db>](task_work_run+0x5d/0x76) [<b00239db>] (task_work_run) from [<b0016767>] (do_exit+0x2db/0x648) [<b0016767>] (do_exit) from [<b0017343>] (do_group_exit+0x33/0x84) [<b0017343>] (do_group_exit) from [<b00id2bf>](get_signal+0xl91/0x49a) [<b00ld2bf>] (get_signal) from [<b000delf>] (do_work pending+0x87/0x26e) [<b000delf>] (do_work pending) from [<b000828f>](slow_work _pending+0x9/0xl6) Signed-off-by: William Wu <william.wu@rock-chips.com> Change-Id: I838d62244e38a20f37ad9b530d5171c5e8de25c4
This commit is contained in:
@@ -732,7 +732,8 @@ int usb_gadget_disconnect(struct usb_gadget *gadget)
|
||||
ret = gadget->ops->pullup(gadget, 0);
|
||||
if (!ret) {
|
||||
gadget->connected = 0;
|
||||
gadget->udc->driver->disconnect(gadget);
|
||||
if (gadget->udc->driver)
|
||||
gadget->udc->driver->disconnect(gadget);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
Reference in New Issue
Block a user