summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2015-02-03 01:24:17 +0300
committerJiri Slaby <jslaby@suse.cz>2015-03-12 19:31:24 +0300
commit2019319b6ab967b7c3de01472b3feca251976cf7 (patch)
treeb0a265a1656ef887a2c718a4f1b697e1047e71d9 /drivers/usb/gadget
parent476b1ec9fb4ab2f34b6bea7b6d6011d24f094597 (diff)
downloadlinux-2019319b6ab967b7c3de01472b3feca251976cf7.tar.xz
usb: gadget: function: phonet: balance usb_ep_disable calls
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@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/f_phonet.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index eb3aa817a662..74ff54141416 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;