mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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>
This commit is contained in:
parent
2035772010
commit
9ec36f7fe2
@ -417,7 +417,10 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock(&port->lock);
|
||||
|
||||
if (fp->in_ep->driver_data)
|
||||
__pn_reset(f);
|
||||
|
||||
if (alt == 1) {
|
||||
int i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user