Skip to contentSkip to conversation

Enforce USB interface claims

PATCH In review Chris Wedgwood 3 participants 4 messages Jan 23, 2005 – Jan 25, 2005 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enforce USB interface claims

Greg,

How would you feel about something like this?

drivers/usb/core/devio.c +1 -4
Index: cw-current/drivers/usb/core/devio.c
===================================================================
@@ -417,10 +417,7 @@
 		return -EINVAL;
 	if (test_bit(ifnum, &ps->ifclaimed))
 		return 0;
-	/* if not yet claimed, claim it for the driver */
-	dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
-	       current->pid, current->comm, ifnum);
-	return claimintf(ps, ifnum);
+	return -EINVAL;
 }
 
 static int findintfep(struct usb_device *dev, unsigned int ep)
#1 lore raw
Quoted 1 line · Chris Wedgwood

Greg,

Adding linux-usb-devel to the CC:

Quoted 8 lines

How would you feel about something like this?

Index: cw-current/drivers/usb/core/devio.c
===================================================================

drivers/usb/core/devio.c +0 -0
@@ -417,10 +417,7 @@
 		return -EINVAL;

drivers/usb/core/devio.c line 423

Quoted 10 lines
drivers/usb/core/devio.c +1 -4
 	if (test_bit(ifnum, &ps->ifclaimed))
 		return 0;
-	/* if not yet claimed, claim it for the driver */
-	dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
-	       current->pid, current->comm, ifnum);
-	return claimintf(ps, ifnum);
+	return -EINVAL;
 }
 
 static int findintfep(struct usb_device *dev, unsigned int ep)

Um, why? I think this is there to help with "broken" userspace code that was written before we enforced the rules of "you must claim an interface before using it." As such, I don't think we can apply this patch.

thanks,

greg k-h

#2 lore raw
Quoted 4 lines · Greg KH

Um, why? I think this is there to help with "broken" userspace code that was written before we enforced the rules of "you must claim an interface before using it. As such, I don't think we can apply this patch.

right now such broken userspace spams kern.log, etc. also it means you can run two or more instances of something that fail to claim the endpoint and then fight over packets from it

#3 lore raw
In reply to Greg KH
Quoted 7 lines
Quoted 7 lines
drivers/usb/core/devio.c +1 -4
-	/* if not yet claimed, claim it for the driver */
-	dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
-	       current->pid, current->comm, ifnum);
-	return claimintf(ps, ifnum);
+	return -EINVAL;
 }
Quoted 7 lines
Quoted 1 line

static int findintfep(struct usb_device *dev, unsigned int ep)

Um, why? I think this is there to help with "broken" userspace code that was written before we enforced the rules of "you must claim an interface before using it." As such, I don't think we can apply this patch.

Unfortunately it also means that there is no pressure to fix the user-space code. How about having it say that the autoclaiming is deprecated, and will be removed at some point?

Ciao,

Duncan.