usb: raw-gadget: fix null-ptr-deref when reenabling endpoints

Currently we preassign gadget endpoints to raw-gadget endpoints during
initialization. Fix resetting this assignment in raw_ioctl_ep_disable(),
otherwise we will get null-ptr-derefs when an endpoint is reenabled.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
This commit is contained in:
Andrey Konovalov 2020-05-13 20:01:42 +02:00 committed by Felipe Balbi
parent 61d2658db4
commit da39b5ee40

View File

@ -867,7 +867,6 @@ static int raw_ioctl_ep_disable(struct raw_dev *dev, unsigned long value)
spin_lock_irqsave(&dev->lock, flags);
usb_ep_free_request(dev->eps[i].ep, dev->eps[i].req);
kfree(dev->eps[i].ep->desc);
dev->eps[i].ep = NULL;
dev->eps[i].state = STATE_EP_DISABLED;
dev->eps[i].disabling = false;