p54usb: fix leaks at failure path in p54u_probe()

If p54u_load_firmware() fails, p54u_probe() does not deallocate
already allocated resources. The patch adds proper failure handling.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Alexey Khoroshilov 2014-03-08 01:11:49 +04:00 committed by John W. Linville
parent 3e3cb6caea
commit f5335e00f3
1 changed files with 4 additions and 0 deletions

View File

@ -1053,6 +1053,10 @@ static int p54u_probe(struct usb_interface *intf,
priv->upload_fw = p54u_upload_firmware_net2280;
}
err = p54u_load_firmware(dev, intf);
if (err) {
usb_put_dev(udev);
p54_free_common(dev);
}
return err;
}