diff options
author | 2023-05-25 18:38:37 +0300 | |
---|---|---|
committer | 2023-05-29 15:24:24 +0100 | |
commit | 016da9c65fec9f0e78c4909ed9a0f2d567af6775 (patch) | |
tree | b4b5ff8647cb828f144a882b3ab8aefae0b7413e /drivers/usb | |
parent | usb: gadget: f_fs: Add unbind event before functionfs_unbind (diff) | |
download | linux-016da9c65fec9f0e78c4909ed9a0f2d567af6775.tar.gz linux-016da9c65fec9f0e78c4909ed9a0f2d567af6775.tar.bz2 linux-016da9c65fec9f0e78c4909ed9a0f2d567af6775.zip |
usb: gadget: udc: fix NULL dereference in remove()
The "udc" pointer was never set in the probe() function so it will
lead to a NULL dereference in udc_pci_remove() when we do:
usb_del_gadget_udc(&udc->gadget);
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/ZG+A/dNpFWAlCChk@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/udc/amd5536udc_pci.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/udc/amd5536udc_pci.c b/drivers/usb/gadget/udc/amd5536udc_pci.c index c80f9bd51b75..a36913ae31f9 100644 --- a/drivers/usb/gadget/udc/amd5536udc_pci.c +++ b/drivers/usb/gadget/udc/amd5536udc_pci.c @@ -170,6 +170,9 @@ static int udc_pci_probe( retval = -ENODEV; goto err_probe; } + + udc = dev; + return 0; err_probe: |