usbfs: Kill urbs on interface before doing a set_interface
authorHans de Goede <hdegoede@redhat.com>
Wed, 9 Oct 2013 15:19:27 +0000 (17:19 +0200)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Tue, 4 Mar 2014 23:38:04 +0000 (15:38 -0800)
The usb_set_interface documentation says:

 * Also, drivers must not change altsettings while urbs are scheduled for
 * endpoints in that interface; all such urbs must first be completed
 * (perhaps forced by unlinking).

For in kernel drivers we trust the drivers to get this right, but we
cannot trust userspace to get this right, so enforce it by killing any
urbs still pending on the interface.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/core/devio.c

index f3ba2e0..2a95e4e 100644 (file)
@@ -1143,6 +1143,9 @@ static int proc_setintf(struct dev_state *ps, void __user *arg)
                return -EFAULT;
        if ((ret = checkintf(ps, setintf.interface)))
                return ret;
+
+       destroy_async_on_interface(ps, setintf.interface);
+
        return usb_set_interface(ps->dev, setintf.interface,
                        setintf.altsetting);
 }