2014-10-10 20:31:25

by Alexey Khoroshilov

[permalink] [raw]
Subject: [PATCH] net: can: esd_usb2: fix memory leak on disconnect

It seems struct esd_usb2 dev is not deallocated on disconnect.

The patch adds the deallocation.

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

Signed-off-by: Alexey Khoroshilov <[email protected]>
---
drivers/net/can/usb/esd_usb2.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index b7c9e8b11460..7a90075529c3 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -1143,6 +1143,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf)
}
}
unlink_all_urbs(dev);
+ kfree(dev);
}
}

--
1.9.1


2014-10-13 08:21:49

by Matthias Fuchs

[permalink] [raw]
Subject: Re: [PATCH] net: can: esd_usb2: fix memory leak on disconnect

Hi Alexey,

On 10/10/2014 10:31 PM, Alexey Khoroshilov wrote:
> It seems struct esd_usb2 dev is not deallocated on disconnect.
>
> The patch adds the deallocation.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <[email protected]>
> ---
> drivers/net/can/usb/esd_usb2.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
> index b7c9e8b11460..7a90075529c3 100644
> --- a/drivers/net/can/usb/esd_usb2.c
> +++ b/drivers/net/can/usb/esd_usb2.c
> @@ -1143,6 +1143,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf)
> }
> }
> unlink_all_urbs(dev);
> + kfree(dev);
> }
> }
>
>
thanks for pointing this out. Marc, can you please catch this up.

Matthias

Acked-by: Matthias Fuchs <[email protected]>

2014-10-18 16:48:21

by Marc Kleine-Budde

[permalink] [raw]
Subject: Re: [PATCH] net: can: esd_usb2: fix memory leak on disconnect

On Sat, Oct 11, 2014 at 12:31:07AM +0400, Alexey Khoroshilov wrote:
> It seems struct esd_usb2 dev is not deallocated on disconnect.
>
> The patch adds the deallocation.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <[email protected]>

Applied to the can tree.

Thanks,
Marc

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |