Patchwork [2/2] can: usb_8dev: fix urb leak on failure path in usb_8dev_start()

login
register
mail settings
Submitter Marc Kleine-Budde
Date July 19, 2013, 1:17 p.m.
Message ID <1374239869-27085-3-git-send-email-mkl@pengutronix.de>
Download mbox | patch
Permalink /patch/260260/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Marc Kleine-Budde - July 19, 2013, 1:17 p.m.
From: Alexey Khoroshilov <khoroshilov@ispras.ru>

If usb_8dev_start() fails to submit urb,
it unanchors the urb but forgets to free it.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/usb_8dev.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c
index cbd388e..8becd3d 100644
--- a/drivers/net/can/usb/usb_8dev.c
+++ b/drivers/net/can/usb/usb_8dev.c
@@ -779,6 +779,7 @@  static int usb_8dev_start(struct usb_8dev_priv *priv)
 			usb_unanchor_urb(urb);
 			usb_free_coherent(priv->udev, RX_BUFFER_SIZE, buf,
 					  urb->transfer_dma);
+			usb_free_urb(urb);
 			break;
 		}