From: Max Kellermann Date: Mon, 21 Mar 2016 11:33:12 +0000 (-0700) Subject: [media] media-devnode: add missing mutex lock in error handler X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=88336e174645948da269e1812f138f727cd2896b;p=linux-beck.git [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 --- 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; }