p54usb: fix leaks at failure path in p54u_probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Fri, 7 Mar 2014 21:11:49 +0000 (01:11 +0400)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 14 Mar 2014 18:49:13 +0000 (14:49 -0400)
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>
drivers/net/wireless/p54/p54usb.c

index b7ab3dfb3de8a758e7d7636970ddfd87918feebd..043bd1c23c19efb6997c33865e41059011052a46 100644 (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;
 }