[media] coda: fix double call to debugfs_remove
authorPeter Seiderer <ps.report@gmx.net>
Tue, 24 Mar 2015 17:30:48 +0000 (14:30 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 10 Apr 2015 13:04:34 +0000 (10:04 -0300)
In coda_free_aux_buf() call debugfs_remove only if buffer entry
is valid (and therfore dentry is valid), double protect by
invalidating dentry value.

Fixes erroneous prematurely dealloc of debugfs caused by
incorrect reference count incrementing.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/coda/coda-common.c

index c82ce56..2906dd2 100644 (file)
@@ -1215,8 +1215,9 @@ void coda_free_aux_buf(struct coda_dev *dev,
                                  buf->vaddr, buf->paddr);
                buf->vaddr = NULL;
                buf->size = 0;
+               debugfs_remove(buf->dentry);
+               buf->dentry = NULL;
        }
-       debugfs_remove(buf->dentry);
 }
 
 static int coda_start_streaming(struct vb2_queue *q, unsigned int count)