[media] media: videobuf2-core: Fix one __qbuf_dmabuf() error path
authorWu, Xia <xia.wu@intel.com>
Wed, 9 Dec 2015 07:26:26 +0000 (05:26 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 1 Feb 2016 09:32:40 +0000 (07:32 -0200)
Add dma_buf_put() to decrease refcount of the dmabuf in error path if DMABUF size is smaller than the requirement.

Signed-off-by: wu xia <xia.wu@intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/videobuf2-core.c

index c5d49d7a0d76d09c1ac5598a21ce7726d03190c1..ec5b78ee6e72b538af0d924dcaa62dffb4a83007 100644 (file)
@@ -1220,6 +1220,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb)
                if (planes[plane].length < vb->planes[plane].min_length) {
                        dprintk(1, "invalid dmabuf length for plane %d\n",
                                plane);
+                       dma_buf_put(dbuf);
                        ret = -EINVAL;
                        goto err;
                }