[media] drivers/media/media-devnode: clear private_data before put_device()
authorMax Kellermann <max@duempel.org>
Mon, 21 Mar 2016 13:30:28 +0000 (10:30 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Sat, 7 May 2016 14:43:53 +0000 (11:43 -0300)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-devnode.c

index 64a4b1e..b66dc9d 100644 (file)
@@ -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;
 }