netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2013-12-17
@ 2013-12-17 10:44 Marc Kleine-Budde
  2013-12-17 10:44 ` [PATCH 1/2] can: ems_usb: fix urb leaks on failure paths Marc Kleine-Budde
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-12-17 10:44 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

this is a pull request with two fixes for net/master, the current release
cycle.

It consists of a patch by Alexey Khoroshilov from the Linux Driver Verification
project, which fixes a memory leak in ems_usb's failure patch. And a patch by
me which fixes a memory leak in the peak usb driver.

regards,
Marc

---

The following changes since commit 9bd7d20c45157c175bfd45449e904a404506f99c:

  sctp: loading sctp when load sctp_probe (2013-12-16 20:04:27 -0500)

are available in the git repository at:

  git://gitorious.org/linux-can/linux-can.git fixes-for-3.13

for you to fetch changes up to 20fb4eb96fb0350d28fc4d7cbfd5506711079592:

  can: peak_usb: fix mem leak in pcan_usb_pro_init() (2013-12-17 11:19:33 +0100)

----------------------------------------------------------------
Alexey Khoroshilov (1):
      can: ems_usb: fix urb leaks on failure paths

Marc Kleine-Budde (1):
      can: peak_usb: fix mem leak in pcan_usb_pro_init()

 drivers/net/can/usb/ems_usb.c               | 3 ++-
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

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

* [PATCH 1/2] can: ems_usb: fix urb leaks on failure paths
  2013-12-17 10:44 pull-request: can 2013-12-17 Marc Kleine-Budde
@ 2013-12-17 10:44 ` Marc Kleine-Budde
  2013-12-17 10:44 ` [PATCH 2/2] can: peak_usb: fix mem leak in pcan_usb_pro_init() Marc Kleine-Budde
  2013-12-17 22:22 ` pull-request: can 2013-12-17 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-12-17 10:44 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel, Alexey Khoroshilov, Marc Kleine-Budde

From: Alexey Khoroshilov <khoroshilov@ispras.ru>

There are a couple failure paths where urb leaks.
Is spare code within ems_usb_start_xmit(),
usb_free_urb() should be used to deallocate urb instead of usb_unanchor_urb().
In ems_usb_start() there is no usb_free_urb() if usb_submit_urb() fails.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Sebastian Haas <dev@sebastianhaas.info>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/ems_usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 5f9a7ad..8aeec0b 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -625,6 +625,7 @@ static int ems_usb_start(struct ems_usb *dev)
 			usb_unanchor_urb(urb);
 			usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
 					  urb->transfer_dma);
+			usb_free_urb(urb);
 			break;
 		}
 
@@ -798,8 +799,8 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
 	 * allowed (MAX_TX_URBS).
 	 */
 	if (!context) {
-		usb_unanchor_urb(urb);
 		usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
+		usb_free_urb(urb);
 
 		netdev_warn(netdev, "couldn't find free context\n");
 
-- 
1.8.5.1


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

* [PATCH 2/2] can: peak_usb: fix mem leak in pcan_usb_pro_init()
  2013-12-17 10:44 pull-request: can 2013-12-17 Marc Kleine-Budde
  2013-12-17 10:44 ` [PATCH 1/2] can: ems_usb: fix urb leaks on failure paths Marc Kleine-Budde
@ 2013-12-17 10:44 ` Marc Kleine-Budde
  2013-12-17 22:22 ` pull-request: can 2013-12-17 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2013-12-17 10:44 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde, linux-stable

This patch fixes a memory leak in pcan_usb_pro_init(). In patch

    f14e224 net: can: peak_usb: Do not do dma on the stack

the struct pcan_usb_pro_fwinfo *fi and struct pcan_usb_pro_blinfo *bi were
converted from stack to dynamic allocation va kmalloc(). However the
corresponding kfree() was not introduced.

This patch adds the missing kfree().

Cc: linux-stable <stable@vger.kernel.org> # v3.10
Reported-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
index 8ee9d15..263dd92 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
@@ -927,6 +927,9 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev)
 	/* set LED in default state (end of init phase) */
 	pcan_usb_pro_set_led(dev, 0, 1);
 
+	kfree(bi);
+	kfree(fi);
+
 	return 0;
 
  err_out:
-- 
1.8.5.1

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

* Re: pull-request: can 2013-12-17
  2013-12-17 10:44 pull-request: can 2013-12-17 Marc Kleine-Budde
  2013-12-17 10:44 ` [PATCH 1/2] can: ems_usb: fix urb leaks on failure paths Marc Kleine-Budde
  2013-12-17 10:44 ` [PATCH 2/2] can: peak_usb: fix mem leak in pcan_usb_pro_init() Marc Kleine-Budde
@ 2013-12-17 22:22 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-12-17 22:22 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Tue, 17 Dec 2013 11:44:47 +0100

> this is a pull request with two fixes for net/master, the current release
> cycle.
> 
> It consists of a patch by Alexey Khoroshilov from the Linux Driver Verification
> project, which fixes a memory leak in ems_usb's failure patch. And a patch by
> me which fixes a memory leak in the peak usb driver.

Pulled, thanks Marc.

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

end of thread, other threads:[~2013-12-17 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-17 10:44 pull-request: can 2013-12-17 Marc Kleine-Budde
2013-12-17 10:44 ` [PATCH 1/2] can: ems_usb: fix urb leaks on failure paths Marc Kleine-Budde
2013-12-17 10:44 ` [PATCH 2/2] can: peak_usb: fix mem leak in pcan_usb_pro_init() Marc Kleine-Budde
2013-12-17 22:22 ` pull-request: can 2013-12-17 David Miller

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).