[3.11.y.z extended stable] Patch "usb: musb: core: properly free host / device structs in err path" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Thu Dec 5 11:25:56 UTC 2013


This is a note to let you know that I have just added a patch titled

    usb: musb: core: properly free host / device structs in err path

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From c832afd2b1480d4d10f3688e5578e61f12b3f676 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
Date: Wed, 16 Oct 2013 12:50:06 +0200
Subject: usb: musb: core: properly free host / device structs in err path

commit 0d2dd7eaed1dac07b266ca2c662ff4a184a3060f upstream.

The patch fixes two issues in the error path cleanup:
- in MUSB_PORT_MODE_DUAL_ROLE mode, if musb_gadget_setup() fails we
  never cleanup the host struct earlier allocated.
- if musb_init_debugfs() or sysfs_create_group() fails, then we never
  free the host part initialization, only device part.

Cc: Daniel Mack <zonque at gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
Signed-off-by: Felipe Balbi <balbi at ti.com>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/usb/musb/musb_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 6ef8c94..41b9d6f 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1962,6 +1962,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 		if (status < 0)
 			goto fail3;
 		status = musb_gadget_setup(musb);
+		if (status)
+			musb_host_cleanup(musb);
 		break;
 	default:
 		dev_err(dev, "unsupported port mode %d\n", musb->port_mode);
@@ -1988,6 +1990,7 @@ fail5:

 fail4:
 	musb_gadget_cleanup(musb);
+	musb_host_cleanup(musb);

 fail3:
 	pm_runtime_put_sync(musb->controller);
--
1.8.3.2





More information about the kernel-team mailing list