diff options
author | Felipe Balbi <balbi@ti.com> | 2015-02-02 17:24:17 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-02-23 01:18:52 -0500 |
commit | 9ec36f7fe20ef919cc15171e1da1b6739222541a (patch) | |
tree | 808aa58e84cbe0f90379b2bcc73d2ea9e0296b8f | |
parent | 2035772010db634ec8566b658fb1cd87ec47ac77 (diff) |
usb: gadget: function: phonet: balance usb_ep_disable calls
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>
-rw-r--r-- | drivers/usb/gadget/function/f_phonet.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index c89e96cfa3e4..c0c3ef272714 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c | |||
@@ -417,7 +417,10 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
417 | return -EINVAL; | 417 | return -EINVAL; |
418 | 418 | ||
419 | spin_lock(&port->lock); | 419 | spin_lock(&port->lock); |
420 | __pn_reset(f); | 420 | |
421 | if (fp->in_ep->driver_data) | ||
422 | __pn_reset(f); | ||
423 | |||
421 | if (alt == 1) { | 424 | if (alt == 1) { |
422 | int i; | 425 | int i; |
423 | 426 | ||