From bf244f665d76d20312c80524689b32a752888838 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Mar 2016 10:30:28 -0300 Subject: [PATCH] [media] drivers/media/media-devnode: clear private_data before put_device() 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 Signed-off-by: Mauro Carvalho Chehab --- 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 64a4b1e..b66dc9d 100644 --- a/drivers/media/media-devnode.c +++ b/drivers/media/media-devnode.c @@ -197,10 +197,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; } -- 2.7.4