All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cooke <mpc@star.sr.bham.ac.uk>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: 2.4.22pre3 / pwc / emi disconnect == oops, workaround
Date: 12 Jul 2003 16:42:23 +0100	[thread overview]
Message-ID: <1058024543.8030.3.camel@sage.kitchen> (raw)

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

             reply	other threads:[~2003-07-12 15:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-12 15:42 Mark Cooke [this message]
2003-07-13  4:17 ` 2.4.22pre3 / pwc / emi disconnect == oops, workaround Greg KH
2003-07-13  8:34 ` Alan Cox
2003-07-13 10:33   ` Mark Cooke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1058024543.8030.3.camel@sage.kitchen \
    --to=mpc@star.sr.bham.ac.uk \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.