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


Groups > linux.kernel > #1361842 > unrolled thread

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

Started byMax Kellermann <max@duempel.org>
First post2016-03-21 14:40 +0100
Last post2016-03-21 14:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromMax Kellermann <max@duempel.org>
Date2016-03-21 14:40 +0100
Subject[PATCH 3/6] drivers/media/media-devnode: clear private_data before put_device()
Message-ID<rf8dQ-6jL-9@gated-at.bofh.it>
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;
 }
 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web