On Sun, May 12, 2002 at 08:37:49PM -0400, Johannes Erdfelt wrote: > On Mon, May 13, 2002, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Playing with some strange device with vendor protocol, > > I find that alt-uhci crashes the kernel without any messages > > or information. (No oops, just dead.) > > On the other hand, uhci comes back with an error message > > > > usb-uhci.c: uhci_submit_urb: pipesize for pipe c0030400 is zero > > > > Since an error message is preferable above a dead system, > > this must be regarded as a bug in alt-uhci. This is 2.5.14. > > I'd consider it undefined behaviour. A wMaxPacketSize of 0 doesn't make > sense at all. That device is broken. > > But, you're absolutely right about an error message being preferable to > a dead system. The patch is simple enough and I've attached it to the > bottom of this message. > > Greg, please apply to 2.4.20 and 2.5. Thanks.
Well, since 0 is not an illegal value as specified in the USB spec, I think we should do this check in the usb_submit_urb() call, not force it to be duplicated in all host drivers. So how about the patch below? Also, your patch on 2.5 would cause urbs to leak if that if () call was ever true. thanks, greg k-h diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c --- a/drivers/usb/core/usb.c Mon May 13 00:24:46 2002 +++ b/drivers/usb/core/usb.c Mon May 13 00:24:46 2002 @@ -1162,10 +1162,15 @@ */ int usb_submit_urb(struct urb *urb, int mem_flags) { - if (urb && urb->dev && urb->dev->bus && urb->dev->bus->op) + + if (urb && urb->dev && urb->dev->bus && urb->dev->bus->op) { + if (usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)) <= 0) { + err("%s: pipe %x has invalid size (<= 0)", __FUNCTION__, +urb->pipe); + return -EMSGSIZE; + } return urb->dev->bus->op->submit_urb(urb, mem_flags); - else - return -ENODEV; + } + return -ENODEV; } /*-------------------------------------------------------------------*/ _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel