2.4.22pre3 / pwc / emi disconnect == oops, workaround

Mark Cooke (mpc@star.sr.bham.ac.uk)
12 Jul 2003 16:42:23 +0100


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-13573-1058024609-0001-2
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Hi Alan, all,

I added an extra check to the videodev.c's video_ioctl, to check vfl is
valid before dereferencing. (See attached patch).

The sequence to trigger the oops appears to be:

1. Open philips usb webcam device (any usb video device with ioctls ?).
2. Wait for (fairly rare) USB EMI issue to be flagged by hub.c.
3. usb.c appears to force a disconnect immediately after #2.
4. pwc module warns about a disconnect while open.
5. Next call to video_ioctl with handle from #1 causes oops.

I added a check to video_icotl to ensure video_device[] isn't NULL
before trying to call the ioctl method, and it returns EINVAL in that
case.

I'm not very familiar with the locking of usb/usb-uhci in this EMI case,
but both host drivers oops in the same way. It would seem the open file
handle needs to be disassociated too somehow - or at least 'defered'
until the video camera is re-enabled after the EMI event.

Best regards,

Mark

PS. I've recently changed the physical layout of the machine, and it
seems the new cabling layout causes these occasional EMI issues.

-- 
Mark Cooke <mpc@star.sr.bham.ac.uk>

--=_courier-13573-1058024609-0001-2 Content-Type: text/plain; name="patch-2.4.22-pre3-ac1-videodev"; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=patch-2.4.22-pre3-ac1-videodev

--- linux-2.4.21/drivers/media/video/videodev.c.orig 2003-06-13 15:51:34.000000000 +0100 +++ linux-2.4.21/drivers/media/video/videodev.c 2003-07-10 23:00:49.000000000 +0100 @@ -209,7 +209,12 @@ unsigned int cmd, unsigned long arg) { struct video_device *vfl = video_devdata(file); - int err=vfl->ioctl(vfl, cmd, (void *)arg); + int err; + + if (!vfl) + return -EINVAL; + + err = vfl->ioctl(vfl, cmd, (void *)arg); if(err!=-ENOIOCTLCMD) return err;

--=_courier-13573-1058024609-0001-2--