linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH: 3.11] usb_8dev: Fix memory leak in usb_8dev_start_xmit
@ 2014-03-24 14:13 Bjorn Van Tilt
  2014-03-24 14:34 ` Marc Kleine-Budde
  2014-03-29  7:17 ` Bernd Krumboeck
  0 siblings, 2 replies; 3+ messages in thread
From: Bjorn Van Tilt @ 2014-03-24 14:13 UTC (permalink / raw)
  To: krumboeck, wg, mkl, linux-can; +Cc: linux-kernel

Fixed a memory leak when an error occurred in the transmit function.
In the error handling the urb wasn't freed before returning. There was
also a call to the usb_unanchor_urb() function but the urb wasn't
anchored.

Signed-off-by: Bjorn Van Tilt <bjorn.vantilt@gmail.com>

---
--- drivers/net/can/usb/usb_8dev.c.orig 2014-03-24 13:40:45.000000000 +0100
+++ drivers/net/can/usb/usb_8dev.c 2014-03-24 13:44:32.076086036 +0100
@@ -698,8 +698,8 @@ static netdev_tx_t usb_8dev_start_xmit(s
  return NETDEV_TX_OK;

 nofreecontext:
- usb_unanchor_urb(urb);
  usb_free_coherent(priv->udev, size, buf, urb->transfer_dma);
+ usb_free_urb(urb);

  netdev_warn(netdev, "couldn't find free context");

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

* Re: [PATCH: 3.11] usb_8dev: Fix memory leak in usb_8dev_start_xmit
  2014-03-24 14:13 [PATCH: 3.11] usb_8dev: Fix memory leak in usb_8dev_start_xmit Bjorn Van Tilt
@ 2014-03-24 14:34 ` Marc Kleine-Budde
  2014-03-29  7:17 ` Bernd Krumboeck
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2014-03-24 14:34 UTC (permalink / raw)
  To: Bjorn Van Tilt, krumboeck, wg, linux-can; +Cc: linux-kernel

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

On 03/24/2014 03:13 PM, Bjorn Van Tilt wrote:
> Fixed a memory leak when an error occurred in the transmit function.
> In the error handling the urb wasn't freed before returning. There was
> also a call to the usb_unanchor_urb() function but the urb wasn't
> anchored.
> 
> Signed-off-by: Bjorn Van Tilt <bjorn.vantilt@gmail.com>

Applied to the can tree.

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   |


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

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

* Re: [PATCH: 3.11] usb_8dev: Fix memory leak in usb_8dev_start_xmit
  2014-03-24 14:13 [PATCH: 3.11] usb_8dev: Fix memory leak in usb_8dev_start_xmit Bjorn Van Tilt
  2014-03-24 14:34 ` Marc Kleine-Budde
@ 2014-03-29  7:17 ` Bernd Krumboeck
  1 sibling, 0 replies; 3+ messages in thread
From: Bernd Krumboeck @ 2014-03-29  7:17 UTC (permalink / raw)
  To: Bjorn Van Tilt, linux-can

Applied to the driver sources (outside kernel tree): https://github.com/krumboeck/usb2can

Thank you!


regards,
Bernd



Am 2014-03-24 15:13, schrieb Bjorn Van Tilt:
> Fixed a memory leak when an error occurred in the transmit function.
> In the error handling the urb wasn't freed before returning. There was
> also a call to the usb_unanchor_urb() function but the urb wasn't
> anchored.
>
> Signed-off-by: Bjorn Van Tilt <bjorn.vantilt@gmail.com>
>
> ---
> --- drivers/net/can/usb/usb_8dev.c.orig 2014-03-24 13:40:45.000000000 +0100
> +++ drivers/net/can/usb/usb_8dev.c 2014-03-24 13:44:32.076086036 +0100
> @@ -698,8 +698,8 @@ static netdev_tx_t usb_8dev_start_xmit(s
>    return NETDEV_TX_OK;
>
>   nofreecontext:
> - usb_unanchor_urb(urb);
>    usb_free_coherent(priv->udev, size, buf, urb->transfer_dma);
> + usb_free_urb(urb);
>
>    netdev_warn(netdev, "couldn't find free context");
>


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

end of thread, other threads:[~2014-03-29  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-24 14:13 [PATCH: 3.11] usb_8dev: Fix memory leak in usb_8dev_start_xmit Bjorn Van Tilt
2014-03-24 14:34 ` Marc Kleine-Budde
2014-03-29  7:17 ` 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).