All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Rankin <rankincj@yahoo.com>
To: Michael Hughes <marynya@compuserve.com>
Cc: linux-media@vger.kernel.org
Subject: [PATCH v2] EM28xx - fix deadlock when unplugging and replugging a DVB adapter
Date: Sat, 24 Sep 2011 21:42:21 +0100	[thread overview]
Message-ID: <4E7E40AD.5060206@yahoo.com> (raw)

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

Mauro,

Pending the complete rethink about how USB devices manage their resources, I am 
resubmitting my fix for the PCTV 290e deadlock that occurs with either multiple 
adapters or when an adapter is replugged.

For DVB devices, the device lock must now *not* be held when adding/removing 
either a device or an extension to the respective lists. (Because 
em28xx_init_dvb() will want to take the lock instead).

Conversely, for Audio-Only devices, the device lock *must* be held when 
adding/removing either a device or an extension to the respective lists.

Signed-off-by: Chris Rankin <rankincj@yahoo.com>

Cheers,
Chris

[-- Attachment #2: EM28xx-replug-deadlock-2.diff --]
[-- Type: text/x-patch, Size: 646 bytes --]

--- linux/drivers/media/video/em28xx/em28xx-cards.c.orig	2011-09-24 21:25:01.000000000 +0100
+++ linux/drivers/media/video/em28xx/em28xx-cards.c	2011-09-24 21:37:42.000000000 +0100
@@ -3005,9 +3005,7 @@
 		goto fail;
 	}
 
-	mutex_unlock(&dev->lock);
 	em28xx_init_extension(dev);
-	mutex_lock(&dev->lock);
 
 	/* Save some power by putting tuner to sleep */
 	v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
@@ -3303,10 +3301,10 @@
 		em28xx_release_resources(dev);
 	}
 
-	mutex_unlock(&dev->lock);
-
 	em28xx_close_extension(dev);
 
+	mutex_unlock(&dev->lock);
+
 	if (!dev->users) {
 		kfree(dev->alt_max_pkt_size);
 		kfree(dev);

                 reply	other threads:[~2011-09-24 20:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4E7E40AD.5060206@yahoo.com \
    --to=rankincj@yahoo.com \
    --cc=linux-media@vger.kernel.org \
    --cc=marynya@compuserve.com \
    /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.