Skip to content
Commit 0d66e048 authored by Evgeny Novikov's avatar Evgeny Novikov Committed by Felipe Balbi
Browse files

usb: gadget: goku_udc: fix potential crashes in probe



goku_probe() goes to error label "err" and invokes goku_remove()
in case of failures of pci_enable_device(), pci_resource_start()
and ioremap(). goku_remove() gets a device from
pci_get_drvdata(pdev) and works with it without any checks, in
particular it dereferences a corresponding pointer. But
goku_probe() did not set this device yet. So, one can expect
various crashes. The patch moves setting the device just after
allocation of memory for it.

Found by Linux Driver Verification project (linuxtesting.org).

Reported-by: default avatarPavel Andrianov <andrianov@ispras.ru>
Signed-off-by: default avatarEvgeny Novikov <novikov@ispras.ru>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 1384ab4f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment