Patchwork [3.5.y.z,extended,stable] Patch "usbfs: Always allow ctrl requests with USB_RECIP_ENDPOINT on" has been added to staging queue

mail settings
Submitter Luis Henriques
Date May 7, 2013, 10:33 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/242144/
State New
Headers show


Luis Henriques - May 7, 2013, 10:33 a.m.
This is a note to let you know that I have just added a patch titled

    usbfs: Always allow ctrl requests with USB_RECIP_ENDPOINT on

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From daad54d3dd678e828f468f909a0dc608d40262b4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <>
Date: Tue, 16 Apr 2013 11:08:33 +0200
Subject: [PATCH] usbfs: Always allow ctrl requests with USB_RECIP_ENDPOINT on
 the ctrl ep

commit 1361bf4b9f9ef45e628a5b89e0fd9bedfdcb7104 upstream.

When usbfs receives a ctrl-request from userspace it calls check_ctrlrecip,
which for a request with USB_RECIP_ENDPOINT tries to map this to an interface
to see if this interface is claimed, except for ctrl-requests with a type of

When trying to use this device:
redirected to a Windows vm running on qemu on top of Linux.

The windows driver makes a ctrl-req with USB_TYPE_CLASS and
USB_RECIP_ENDPOINT with index 0, and the mapping of the endpoint (0) to
the interface fails since ep 0 is the ctrl endpoint and thus never is
part of an interface.

This patch fixes this ctrl-req failing by skipping the checkintf call for
USB_RECIP_ENDPOINT ctrl-reqs on the ctrl endpoint.

Reported-by: Dave Stikkolorum <>
Tested-by: Dave Stikkolorum <>
Signed-off-by: Hans de Goede <>
Acked-by: Alan Stern <>
Signed-off-by: Greg Kroah-Hartman <>
Signed-off-by: Luis Henriques <>
 drivers/usb/core/devio.c | 2 ++
 1 file changed, 2 insertions(+)



diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 62679bc..f70b887 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -681,6 +681,8 @@  static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
 	index &= 0xff;
 	switch (requesttype & USB_RECIP_MASK) {
+		if ((index & ~USB_DIR_IN) == 0)
+			return 0;
 		ret = findintfep(ps->dev, index);
 		if (ret >= 0)
 			ret = checkintf(ps, ret);