lkml.org 
[lkml]   [2014]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] p54usb: fix leaks at failure path in p54u_probe()
On Sat, Mar 8, 2014 at 2:41 AM, Alexey Khoroshilov
<khoroshilov@ispras.ru> wrote:
> 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>
> ---
> drivers/net/wireless/p54/p54usb.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
> index 6e635cfa24c8..5df74503fd4f 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;
> }
The load_firmware puts down the reference
in case of error. Only free is required here.


\
 
 \ /
  Last update: 2014-03-09 00:21    [W:0.055 / U:2.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site