can: ems_usb: Fix memory leak on ems_usb_disconnect()
authorAnton Vasilyev <vasilyev@ispras.ru>
Fri, 27 Jul 2018 15:50:42 +0000 (18:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Aug 2018 14:20:48 +0000 (16:20 +0200)
commit 72c05f32f4a5055c9c8fe889bb6903ec959c0aad upstream.

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 <vasilyev@ispras.ru>
Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/can/usb/ems_usb.c

index b00358297424604634489a9b106bf313c06b7fc9..d0846ae9e0e4084f3d57358c29d705d1c933a8a4 100644 (file)
@@ -1071,6 +1071,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);
        }
 }