[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190402004318.30309-2-shuah@kernel.org>
Date: Mon, 1 Apr 2019 18:43:18 -0600
From: Shuah Khan <shuah@...nel.org>
To: mchehab@...nel.org
Cc: Shuah Khan <shuah@...nel.org>, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] media: Clear devnode->media_dev holding media_devnode_lock
Fix media_devnode_unregister() to clear devnode->media_dev while holding
media_devnode_lock. media_devnode_register()'s cdev_add_error handling
does this correctly.
Signed-off-by: Shuah Khan <shuah@...nel.org>
---
drivers/media/media-devnode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index 6b87a721dc49..d92a68a7ad5b 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -290,8 +290,9 @@ void media_devnode_unregister(struct media_devnode *devnode)
mutex_lock(&media_devnode_lock);
/* Delete the cdev on this minor as well */
cdev_device_del(&devnode->cdev, &devnode->dev);
- mutex_unlock(&media_devnode_lock);
devnode->media_dev = NULL;
+ mutex_unlock(&media_devnode_lock);
+
put_device(&devnode->dev);
}
--
2.17.1
Powered by blists - more mailing lists