[PATCH] can: ems_usb: Fix memory leak on ems_usb_disconnect

Subsystems: can network drivers, the rest

STALE2934d

2 messages, 2 authors, 2018-07-30 · open the first message on its own page

[PATCH] can: ems_usb: Fix memory leak on ems_usb_disconnect

From: Anton Vasilyev <hidden>
Date: 2018-07-27 15:51:04

ems_usb_probe() allocates memory for dev->tx_msg_buffer, but there
is no its deallocation in ems_usb_disconnect.

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

Signed-off-by: Anton Vasilyev <redacted>
---
 drivers/net/can/usb/ems_usb.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 12ff0020ecd6..b7dfd4109d24 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -1072,6 +1072,7 @@ static void ems_usb_disconnect(struct usb_interface *intf)
 		usb_free_urb(dev->intr_urb);
 
 		kfree(dev->intr_in_buffer);
+		kfree(dev->tx_msg_buffer);
 	}
 }
 
-- 
2.18.0

Re: [PATCH] can: ems_usb: Fix memory leak on ems_usb_disconnect

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2018-07-30 09:09:26

On 07/27/2018 05:50 PM, Anton Vasilyev wrote:
ems_usb_probe() allocates memory for dev->tx_msg_buffer, but there
is no its deallocation in ems_usb_disconnect.

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

Signed-off-by: Anton Vasilyev <redacted>
Applied to linux-can.

Tnx,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help