From: Shuah Khan <shuah@kernel.org>
To: mchehab@kernel.org
Cc: Shuah Khan <shuah@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: Clear devnode->media_dev holding media_devnode_lock
Date: Mon, 1 Apr 2019 18:43:18 -0600 [thread overview]
Message-ID: <20190402004318.30309-2-shuah@kernel.org> (raw)
In-Reply-To: <20190402004318.30309-1-shuah@kernel.org>
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@kernel.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
prev parent reply other threads:[~2019-04-02 0:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-02 0:43 [PATCH] au0828: Fix NULL pointer dereference in au0828_analog_stream_enable() Shuah Khan
2019-04-02 0:43 ` Shuah Khan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190402004318.30309-2-shuah@kernel.org \
--to=shuah@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox