Linux Media Controller development
 help / color / mirror / Atom feed
From: Adam Baker <linux@baker-net.org.uk>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: kilgota@banach.math.auburn.edu,
	"Jean-Francois Moine" <moinejf@free.fr>,
	linux-media@vger.kernel.org
Subject: Re: Bug in gspca USB webcam driver
Date: Mon, 2 Feb 2009 21:35:00 +0000	[thread overview]
Message-ID: <200902022135.00908.linux@baker-net.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0902021558280.10089-100000@iolanthe.rowland.org>

On Monday 02 February 2009, Alan Stern wrote:
> On Mon, 2 Feb 2009 kilgota@banach.math.auburn.edu wrote:
> > The attached file is an extract from dmesg from the Pentium4 Dual Core
> > machine. One can see that the camera has been attached, and then an svv
> > session has been run. The kernel is the "stock" Slackware 2.6.27.7 kernel
> > (*). We have a situation, again, in which svv (**) can not be exited. We
> > have an oops in the log, and we have a filesystem check on reboot, which
> > is going on as I write this.
>
> Well, the problem is clear enough, and it is in the gspca.c module, not
> your sq905-3 driver.  I'm not sure what the best way is to fix it, so
> I'm CC'ing the people responsible for the gspca driver.
>
Thanks for confirming that Alan. I'd been looking at this too and suspected 
this was the case but as it wouldn't fail on my uniprocessor machine I 
couldn't prove it. (Theodore, if you can generate the log we discussed of 
this failing it might still be helpful in tracking down the underlying 
problem.)

> To summarize: Unplugging the camera while it is in use by a program
> causes an oops (particularly on an SMP machine).
>
> The problem is that gspca_stream_off() calls destroy_urbs(), which in
> turn calls usb_buffer_free() -- but this happens too late, after
> gspca_disconnect() has returned.  By that time gspca_dev->dev is a
> stale pointer, so it shouldn't be passed to usb_buffer_free().
>

By my reading it should be OK for gspca_disconnect to have returned as long as 
video_unregister_device waits for the last close to complete before calling 
gspca_release. I know that there were some patches a while back that 
attempted to ensure that was the case so I suspect there is still a hole 
there.

> What should happen is that as part of disconnect processing, the
> existing stream(s) should be put in an error state and destroy_urbs()
> should be called immediately.  Then when gspca_stream_off() calls
> destroy_urbs() again there would be no more work left to do.
>
> Alan Stern
>

Adam Baker


  reply	other threads:[~2009-02-02 21:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LNX.2.00.0902021207550.32604@banach.math.auburn.edu>
2009-02-02 21:15 ` Bug in gspca USB webcam driver Alan Stern
2009-02-02 21:35   ` Adam Baker [this message]
2009-02-02 21:59     ` Alan Stern
2009-02-02 22:40       ` kilgota
2009-02-02 23:28       ` Adam Baker
2009-02-03  0:31         ` kilgota
2009-02-03  3:37         ` Alan Stern
2009-02-02 22:53     ` kilgota

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=200902022135.00908.linux@baker-net.org.uk \
    --to=linux@baker-net.org.uk \
    --cc=kilgota@banach.math.auburn.edu \
    --cc=linux-media@vger.kernel.org \
    --cc=moinejf@free.fr \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox