[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1427292138-7021-147-git-send-email-luis.henriques@canonical.com>
Date: Wed, 25 Mar 2015 14:01:59 +0000
From: Luis Henriques <luis.henriques@...onical.com>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
kernel-team@...ts.ubuntu.com
Cc: Felipe Balbi <balbi@...com>,
Luis Henriques <luis.henriques@...onical.com>
Subject: [PATCH 3.16.y-ckt 146/165] usb: gadget: function: phonet: balance usb_ep_disable calls
3.16.7-ckt9 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <balbi@...com>
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@...il.com>
Signed-off-by: Felipe Balbi <balbi@...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@...onical.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists