Skip to contentSkip to conversation

Avoid sysfs oops when an rc_dev's raw device is absent

3.0.y+ New Douglas Bagnall 2 participants 3 messages Aug 7, 2012 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20120806173851.GE2979@herton-Z68MA-D2H-B3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 3 lines · Ben Hutchings

This returns without unlocking dev->lock, which isn't much of an improvement. Please get that fixed in mainline, and then I can apply both of the changes to 3.2.y at once.

Oh dear. Quite right. Sorry. Thanks.

Douglas

Quoted 1 line

From c1d4df58efb2d13551586d177bcbb4e9af588618 Mon Sep 17 00:00:00 2001

From: Douglas Bagnall <[email protected]>
Date: Tue, 7 Aug 2012 19:30:36 +1200
Subject: [PATCH] Unlock the rc_dev lock when the raw device is missing

As pointed out by Ben Hutchings, after commit 720bb6436, the lock was being taken and not released when an rc_dev has a NULL raw device.

---
 drivers/media/rc/rc-main.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/rc-main.c +3 -2
index cabc19c..dcd45d0 100644
@@ -778,9 +778,10 @@ static ssize_t show_protocols(struct device *device,
 	} else if (dev->raw) {
 		enabled = dev->raw->enabled_protocols;
 		allowed = ir_raw_get_allowed_protocols();
-	} else
+	} else {
+		mutex_unlock(&dev->lock);
 		return -ENODEV;
-
+	}
 	IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
 		   (long long)allowed,
 		   (long long)enabled);
Signature · 1 line
1.7.9.5
#3 lore raw
Quoted 4 lines · Douglas Bagnall
Quoted 3 lines · Ben Hutchings

This returns without unlocking dev->lock, which isn't much of an improvement. Please get that fixed in mainline, and then I can apply both of the changes to 3.2.y at once.

Thanks for reviewing it Ben.

Quoted 10 lines

Oh dear. Quite right. Sorry. Thanks.

Douglas

From c1d4df58efb2d13551586d177bcbb4e9af588618 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <[email protected]>
Date: Tue, 7 Aug 2012 19:30:36 +1200
Subject: [PATCH] Unlock the rc_dev lock when the raw device is missing

Quoted 4 lines

As pointed out by Ben Hutchings, after commit 720bb6436, the lock was being taken and not released when an rc_dev has a NULL raw device.

As it's desired for stable, this could also have
"Cc: [email protected]" when applied, so it's picked up "automatically" when lands in mainline. Also nitpicking some more, may be the patch could have a Reported-by line added.

Quoted 24 lines
---
 drivers/media/rc/rc-main.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/rc-main.c +3 -2
index cabc19c..dcd45d0 100644
@@ -778,9 +778,10 @@ static ssize_t show_protocols(struct device *device,
 	} else if (dev->raw) {
 		enabled = dev->raw->enabled_protocols;
 		allowed = ir_raw_get_allowed_protocols();
-	} else
+	} else {
+		mutex_unlock(&dev->lock);
 		return -ENODEV;
-
+	}
 	IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
 		   (long long)allowed,
 		   (long long)enabled);
Signature · 1 line
1.7.9.5
Signature · 2 lines
[]'s
Herton
#4 lore raw

PATCH 1/1 Unlock the rc_dev lock when the raw device is missing

Quoted 4 lines · Herton Ronaldo Krzesinski

As it's desired for stable, this could also have
"Cc: [email protected]" when applied, so it's picked up "automatically" when lands in mainline. Also nitpicking some more, may be the patch could have a Reported-by line added.

OK. Here it is again, with CC: stable, Reported-by Ben, and Herton's Acked-by.

thanks,

Douglas

Quoted 1 line

From 47aadfdaa5a6e5c3d8f1bf2b5be4c4a4156085ee Mon Sep 17 00:00:00 2001

From: Douglas Bagnall <[email protected]>
Date: Tue, 7 Aug 2012 19:30:36 +1200
Subject: [PATCH] Unlock the rc_dev lock when the raw device is missing

As pointed out by Ben Hutchings, after commit 720bb6436, the lock was being taken and not released when an rc_dev has a NULL raw device.

---
 drivers/media/rc/rc-main.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/rc-main.c +3 -2
index cabc19c..dcd45d0 100644
@@ -778,9 +778,10 @@ static ssize_t show_protocols(struct device *device,
 	} else if (dev->raw) {
 		enabled = dev->raw->enabled_protocols;
 		allowed = ir_raw_get_allowed_protocols();
-	} else
+	} else {
+		mutex_unlock(&dev->lock);
 		return -ENODEV;
-
+	}
 	IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
 		   (long long)allowed,
 		   (long long)enabled);
Signature · 1 line
1.7.9.5