linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rc-core: don't return from store_protocols without releasing device mutex
@ 2012-12-08 12:50 Sasha Levin
  2012-12-20 16:39 ` Sasha Levin
  2012-12-25 16:40 ` David Härdeman
  0 siblings, 2 replies; 3+ messages in thread
From: Sasha Levin @ 2012-12-08 12:50 UTC (permalink / raw)
  To: mchehab; +Cc: david, linux-media, linux-kernel, Sasha Levin

Commit c003ab1b ("[media] rc-core: add separate defines for protocol bitmaps
and numbers") has introduced a bug which allows store_protocols() to return
without releasing the device mutex it's holding.

Doing that would cause infinite hangs waiting on device mutex next time
around.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 drivers/media/rc/rc-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 601d1ac1..0510f4d 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -890,7 +890,8 @@ static ssize_t store_protocols(struct device *device,
 
 		if (i == ARRAY_SIZE(proto_names)) {
 			IR_dprintk(1, "Unknown protocol: '%s'\n", tmp);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto out;
 		}
 
 		count++;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rc-core: don't return from store_protocols without releasing device mutex
  2012-12-08 12:50 [PATCH] rc-core: don't return from store_protocols without releasing device mutex Sasha Levin
@ 2012-12-20 16:39 ` Sasha Levin
  2012-12-25 16:40 ` David Härdeman
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2012-12-20 16:39 UTC (permalink / raw)
  To: Sasha Levin; +Cc: mchehab, david, linux-media, linux-kernel

Ping?

On Sat, Dec 8, 2012 at 7:50 AM, Sasha Levin <sasha.levin@oracle.com> wrote:
> Commit c003ab1b ("[media] rc-core: add separate defines for protocol bitmaps
> and numbers") has introduced a bug which allows store_protocols() to return
> without releasing the device mutex it's holding.
>
> Doing that would cause infinite hangs waiting on device mutex next time
> around.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  drivers/media/rc/rc-main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index 601d1ac1..0510f4d 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -890,7 +890,8 @@ static ssize_t store_protocols(struct device *device,
>
>                 if (i == ARRAY_SIZE(proto_names)) {
>                         IR_dprintk(1, "Unknown protocol: '%s'\n", tmp);
> -                       return -EINVAL;
> +                       ret = -EINVAL;
> +                       goto out;
>                 }
>
>                 count++;
> --
> 1.8.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rc-core: don't return from store_protocols without releasing device mutex
  2012-12-08 12:50 [PATCH] rc-core: don't return from store_protocols without releasing device mutex Sasha Levin
  2012-12-20 16:39 ` Sasha Levin
@ 2012-12-25 16:40 ` David Härdeman
  1 sibling, 0 replies; 3+ messages in thread
From: David Härdeman @ 2012-12-25 16:40 UTC (permalink / raw)
  To: Sasha Levin; +Cc: mchehab, linux-media, linux-kernel

On Sat, Dec 08, 2012 at 07:50:50AM -0500, Sasha Levin wrote:
>Commit c003ab1b ("[media] rc-core: add separate defines for protocol bitmaps
>and numbers") has introduced a bug which allows store_protocols() to return
>without releasing the device mutex it's holding.
>
>Doing that would cause infinite hangs waiting on device mutex next time
>around.
>
>Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Acked-by: David Härdeman <david@hardeman.nu>

>---
> drivers/media/rc/rc-main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
>index 601d1ac1..0510f4d 100644
>--- a/drivers/media/rc/rc-main.c
>+++ b/drivers/media/rc/rc-main.c
>@@ -890,7 +890,8 @@ static ssize_t store_protocols(struct device *device,
> 
> 		if (i == ARRAY_SIZE(proto_names)) {
> 			IR_dprintk(1, "Unknown protocol: '%s'\n", tmp);
>-			return -EINVAL;
>+			ret = -EINVAL;
>+			goto out;
> 		}
> 
> 		count++;
>-- 
>1.8.0
>

-- 
David Härdeman

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-25 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-08 12:50 [PATCH] rc-core: don't return from store_protocols without releasing device mutex Sasha Levin
2012-12-20 16:39 ` Sasha Levin
2012-12-25 16:40 ` David Härdeman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).