2016-03-21 11:33:20

by Max Kellermann

[permalink] [raw]
Subject: [PATCH] drivers/media/media-devnode: add missing mutex lock in error handler


---
drivers/media/media-devnode.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index cea35bf..4d7e8dd 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -266,8 +266,11 @@ int __must_check media_devnode_register(struct media_devnode *mdev,
return 0;

error:
+ mutex_lock(&media_devnode_lock);
cdev_del(&mdev->cdev);
clear_bit(mdev->minor, media_devnode_nums);
+ mutex_unlock(&media_devnode_lock);
+
return ret;
}



2016-03-21 12:25:36

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH] drivers/media/media-devnode: add missing mutex lock in error handler

Em Mon, 21 Mar 2016 12:33:12 +0100
Max Kellermann <[email protected]> escreveu:


Please, always send us your Signed-off-by on your patches, as described at:
https://linuxtv.org/wiki/index.php/Development:_Submitting_Patches#Developer.27s_Certificate_of_Origin_1.1

Also, please add a description to the patch.

Thanks,
Mauro

> ---
> drivers/media/media-devnode.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
> index cea35bf..4d7e8dd 100644
> --- a/drivers/media/media-devnode.c
> +++ b/drivers/media/media-devnode.c
> @@ -266,8 +266,11 @@ int __must_check media_devnode_register(struct media_devnode *mdev,
> return 0;
>
> error:
> + mutex_lock(&media_devnode_lock);
> cdev_del(&mdev->cdev);
> clear_bit(mdev->minor, media_devnode_nums);
> + mutex_unlock(&media_devnode_lock);
> +
> return ret;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html


--
Thanks,
Mauro