public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.4.22pre3 / pwc / emi disconnect == oops, workaround
@ 2003-07-12 15:42 Mark Cooke
  2003-07-13  4:17 ` Greg KH
  2003-07-13  8:34 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Cooke @ 2003-07-12 15:42 UTC (permalink / raw)
  To: Alan Cox; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]

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>

[-- Attachment #2: patch-2.4.22-pre3-ac1-videodev --]
[-- Type: text/plain, Size: 462 bytes --]

--- 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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-07-13 10:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-12 15:42 2.4.22pre3 / pwc / emi disconnect == oops, workaround Mark Cooke
2003-07-13  4:17 ` Greg KH
2003-07-13  8:34 ` Alan Cox
2003-07-13 10:33   ` Mark Cooke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox