Skip to content

Commit

Permalink
usb: gadget: udc: fix NULL dereference in remove()
Browse files Browse the repository at this point in the history
[ Upstream commit 016da9c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jun 28, 2023
1 parent a930aec commit 18ae8c2
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 @@ -171,6 +171,9 @@ static int udc_pci_probe(
retval = -ENODEV;
goto err_probe;
}

udc = dev;

return 0;

err_probe:
Expand Down

0 comments on commit 18ae8c2

Please sign in to comment.