netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: usb_8dev: fix urb leak on failure path in usb_8dev_start()
@ 2013-07-17 21:20 Alexey Khoroshilov
  2013-07-19 12:54 ` Marc Kleine-Budde
  2013-07-28  7:45 ` Bernd Krumboeck
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2013-07-17 21:20 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde
  Cc: Alexey Khoroshilov, Bernd Krumboeck, linux-can, netdev,
	linux-kernel, ldv-project

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>
---
 drivers/net/can/usb/usb_8dev.c | 1 +
 1 file changed, 1 insertion(+)

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;
 		}
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: usb_8dev: fix urb leak on failure path in usb_8dev_start()
  2013-07-17 21:20 [PATCH] can: usb_8dev: fix urb leak on failure path in usb_8dev_start() Alexey Khoroshilov
@ 2013-07-19 12:54 ` Marc Kleine-Budde
  2013-07-28  7:45 ` Bernd Krumboeck
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2013-07-19 12:54 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Wolfgang Grandegger, Bernd Krumboeck, linux-can, netdev,
	linux-kernel, ldv-project

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

On 07/17/2013 11:20 PM, Alexey Khoroshilov wrote:
> 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>

Thanks, added to can/fixes-for-3.11

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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: usb_8dev: fix urb leak on failure path in usb_8dev_start()
  2013-07-17 21:20 [PATCH] can: usb_8dev: fix urb leak on failure path in usb_8dev_start() Alexey Khoroshilov
  2013-07-19 12:54 ` Marc Kleine-Budde
@ 2013-07-28  7:45 ` Bernd Krumboeck
  1 sibling, 0 replies; 3+ messages in thread
From: Bernd Krumboeck @ 2013-07-28  7:45 UTC (permalink / raw)
  To: linux-can
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, netdev, linux-kernel,
	ldv-project

Thanks!

Added to repository on github: https://github.com/krumboeck/usb2can

regards,
Bernd


Am 2013-07-17 23:20, schrieb Alexey Khoroshilov:
> 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>
> ---
>   drivers/net/can/usb/usb_8dev.c | 1 +
>   1 file changed, 1 insertion(+)
>
> 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;
>   		}
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-28  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-17 21:20 [PATCH] can: usb_8dev: fix urb leak on failure path in usb_8dev_start() Alexey Khoroshilov
2013-07-19 12:54 ` Marc Kleine-Budde
2013-07-28  7:45 ` Bernd Krumboeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).