Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1361842

[PATCH 3/6] drivers/media/media-devnode: clear private_data before put_device()

From Max Kellermann <max@duempel.org>
Newsgroups linux.kernel
Subject [PATCH 3/6] drivers/media/media-devnode: clear private_data before put_device()
Date 2016-03-21 14:40 +0100
Message-ID <rf8dQ-6jL-9@gated-at.bofh.it> (permalink)
References <rf8dQ-6jL-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Callbacks invoked from put_device() may free the struct media_devnode
pointer, so any cleanup needs to be done before put_device().

Signed-off-by: Max Kellermann <max@duempel.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 4d7e8dd..e263816 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -196,10 +196,11 @@ static int media_release(struct inode *inode, struct file *filp)
 	if (mdev->fops->release)
 		mdev->fops->release(filp);
 
+	filp->private_data = NULL;
+
 	/* decrease the refcount unconditionally since the release()
 	   return value is ignored. */
 	put_device(&mdev->dev);
-	filp->private_data = NULL;
 	return 0;
 }
 

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3/6] drivers/media/media-devnode: clear private_data before  put_device() Max Kellermann <max@duempel.org> - 2016-03-21 14:40 +0100

csiph-web