[3.16.y-ckt stable] Patch "usb: gadget: function: phonet: balance usb_ep_disable calls" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Tue Mar 24 15:35:15 UTC 2015


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

    usb: gadget: function: phonet: balance usb_ep_disable calls

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

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

This patch is scheduled to be released in version 3.16.7-ckt9.

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.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 3de70a7f0e1f864cc2da0a036d277359af5447fb Mon Sep 17 00:00:00 2001
From: Felipe Balbi <balbi at ti.com>
Date: Mon, 2 Feb 2015 16:24:17 -0600
Subject: usb: gadget: function: phonet: balance usb_ep_disable calls
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

commit 9ec36f7fe20ef919cc15171e1da1b6739222541a upstream.

f_phonet's ->set_alt() method will call usb_ep_disable()
potentially on an endpoint which is already disabled. That's
something the gadget/function driver must guarantee that it's
always balanced.

In order to balance the calls, just make sure the endpoint
was enabled before by means of checking the validity of
driver_data.

Reported-by: Pali Rohár <pali.rohar at gmail.com>
Signed-off-by: Felipe Balbi <balbi at ti.com>
[ luis: backported to 3.16:
  - file rename: drivers/usb/gadget/function/f_phonet.c ->
    drivers/usb/gadget/f_phonet.c ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/usb/gadget/f_phonet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index f2b781773eed..c2f12c85c6f8 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -417,7 +417,10 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 			return -EINVAL;

 		spin_lock(&port->lock);
-		__pn_reset(f);
+
+		if (fp->in_ep->driver_data)
+			__pn_reset(f);
+
 		if (alt == 1) {
 			int i;





More information about the kernel-team mailing list