Skip to content

Commit

Permalink
usb: gadget: udc: fix NULL dereference in remove()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed May 29, 2023
1 parent efb6b53 commit 016da9c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/gadget/udc/amd5536udc_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ static int udc_pci_probe(
retval = -ENODEV;
goto err_probe;
}

udc = dev;

return 0;

err_probe:
Expand Down

0 comments on commit 016da9c

Please sign in to comment.