From 88336e174645948da269e1812f138f727cd2896b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Mar 2016 04:33:12 -0700 Subject: [PATCH] [media] media-devnode: add missing mutex lock in error handler We should protect the device unregister patch too, at the error condition. Signed-off-by: Max Kellermann Signed-off-by: Mauro Carvalho Chehab --- 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 29409f440f1c..64a4b1ef3dcd 100644 --- a/drivers/media/media-devnode.c +++ b/drivers/media/media-devnode.c @@ -267,8 +267,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; } -- 2.39.5