* [patch] [media] rc: double unlock in rc_register_device()
@ 2011-05-26 8:52 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2011-05-26 8:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Jarod Wilson, David Härdeman, Dmitry Torokhov,
open list:MEDIA INPUT INFRA...,
kernel-janitors
If change_protocol() fails and we goto out_raw, then it calls unlock
twice. I noticed that the other time we called change_protocol() we
held the &dev->lock, so I changed it to hold it here too.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Compile tested only.
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index f57cd56..136a6c6 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1097,7 +1097,6 @@ int rc_register_device(struct rc_dev *dev)
if (rc < 0)
goto out_input;
}
- mutex_unlock(&dev->lock);
if (dev->change_protocol) {
rc = dev->change_protocol(dev, rc_map->rc_type);
@@ -1105,6 +1104,8 @@ int rc_register_device(struct rc_dev *dev)
goto out_raw;
}
+ mutex_unlock(&dev->lock);
+
IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n",
dev->devno,
dev->driver_name ? dev->driver_name : "unknown",
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch] [media] rc: double unlock in rc_register_device()
@ 2011-05-26 8:52 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2011-05-26 8:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Jarod Wilson, David Härdeman, Dmitry Torokhov,
open list:MEDIA INPUT INFRA...,
kernel-janitors
If change_protocol() fails and we goto out_raw, then it calls unlock
twice. I noticed that the other time we called change_protocol() we
held the &dev->lock, so I changed it to hold it here too.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Compile tested only.
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index f57cd56..136a6c6 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1097,7 +1097,6 @@ int rc_register_device(struct rc_dev *dev)
if (rc < 0)
goto out_input;
}
- mutex_unlock(&dev->lock);
if (dev->change_protocol) {
rc = dev->change_protocol(dev, rc_map->rc_type);
@@ -1105,6 +1104,8 @@ int rc_register_device(struct rc_dev *dev)
goto out_raw;
}
+ mutex_unlock(&dev->lock);
+
IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n",
dev->devno,
dev->driver_name ? dev->driver_name : "unknown",
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch] [media] rc: double unlock in rc_register_device()
2011-05-26 8:52 ` Dan Carpenter
@ 2011-05-26 14:49 ` Jarod Wilson
-1 siblings, 0 replies; 4+ messages in thread
From: Jarod Wilson @ 2011-05-26 14:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Mauro Carvalho Chehab, David Härdeman, Dmitry Torokhov,
open list:MEDIA INPUT INFRA...,
kernel-janitors
Dan Carpenter wrote:
> If change_protocol() fails and we goto out_raw, then it calls unlock
> twice.
Gah, good catch, I gotta quit adding new bugs... ;)
> I noticed that the other time we called change_protocol() we
> held the &dev->lock, so I changed it to hold it here too.
>
> Signed-off-by: Dan Carpenter<error27@gmail.com>
> ---
> Compile tested only.
I've sanity-checked the code, and yeah, calling change_protocol()
function pointers with the lock held should be perfectly fine here too.
The change_protocol functions are device-driver-specific, and don't
touch the core rc device lock.
Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] [media] rc: double unlock in rc_register_device()
@ 2011-05-26 14:49 ` Jarod Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Jarod Wilson @ 2011-05-26 14:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Mauro Carvalho Chehab, David Härdeman, Dmitry Torokhov,
open list:MEDIA INPUT INFRA...,
kernel-janitors
Dan Carpenter wrote:
> If change_protocol() fails and we goto out_raw, then it calls unlock
> twice.
Gah, good catch, I gotta quit adding new bugs... ;)
> I noticed that the other time we called change_protocol() we
> held the &dev->lock, so I changed it to hold it here too.
>
> Signed-off-by: Dan Carpenter<error27@gmail.com>
> ---
> Compile tested only.
I've sanity-checked the code, and yeah, calling change_protocol()
function pointers with the lock held should be perfectly fine here too.
The change_protocol functions are device-driver-specific, and don't
touch the core rc device lock.
Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-26 14:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 8:52 [patch] [media] rc: double unlock in rc_register_device() Dan Carpenter
2011-05-26 8:52 ` Dan Carpenter
2011-05-26 14:49 ` Jarod Wilson
2011-05-26 14:49 ` Jarod Wilson
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.