From: Alexey Khoroshilov Date: Fri, 7 Mar 2014 21:11:49 +0000 (+0400) Subject: p54usb: fix leaks at failure path in p54u_probe() X-Git-Tag: accepted/tizen/common/20141203.182822~316^2~18^2^2~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f5335e00f30ef69f093e5074ecf8ef5e778baf3b;p=platform%2Fkernel%2Flinux-arm64.git 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 Acked-by: Christian Lamparter Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index b7ab3df..043bd1c 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c @@ -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; }