[media] media-devnode: add missing mutex lock in error handler
authorMax Kellermann <max@duempel.org>
Mon, 21 Mar 2016 11:33:12 +0000 (04:33 -0700)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 6 Apr 2016 12:39:56 +0000 (05:39 -0700)
We should protect the device unregister patch too, at the error
condition.

Signed-off-by: Max Kellermann <max@duempel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-devnode.c

index 29409f4..64a4b1e 100644 (file)
@@ -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;
 }