* [PATCH] media: videobuf2-core: Fix one __qbuf_dmabuf() error path
@ 2015-12-09 7:26 Wu, Xia
2015-12-09 8:25 ` Sakari Ailus
0 siblings, 1 reply; 3+ messages in thread
From: Wu, Xia @ 2015-12-09 7:26 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: sakari.ailus, mchehab, horms+renesas, laurent.pinchart
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>
---
drivers/media/v4l2-core/videobuf2-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 33bdd81..1f232e7 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1084,6 +1084,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb)
if (planes[plane].length < q->plane_sizes[plane]) {
dprintk(1, "invalid dmabuf length for plane %d\n",
plane);
+ dma_buf_put(dbuf);
ret = -EINVAL;
goto err;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: videobuf2-core: Fix one __qbuf_dmabuf() error path
2015-12-09 7:26 [PATCH] media: videobuf2-core: Fix one __qbuf_dmabuf() error path Wu, Xia
@ 2015-12-09 8:25 ` Sakari Ailus
2015-12-10 4:33 ` Wu, Xia
0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2015-12-09 8:25 UTC (permalink / raw)
To: Wu, Xia, Linux Media Mailing List
Cc: mchehab, horms+renesas, laurent.pinchart, Hans Verkuil
Hi Wu,
Wu, Xia wrote:
> 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>
> ---
> drivers/media/v4l2-core/videobuf2-core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index 33bdd81..1f232e7 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -1084,6 +1084,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb)
> if (planes[plane].length < q->plane_sizes[plane]) {
> dprintk(1, "invalid dmabuf length for plane %d\n",
> plane);
> + dma_buf_put(dbuf);
> ret = -EINVAL;
> goto err;
> }
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Looks like the bug has been also in the original implementation, and the
code has been in a bit of flux since, yet the bug has remained...
I think it'd be nice to have this in stable kernels. Mauro, Hans, what
do you think?
--
Kind regards,
Sakari Ailus
sakari.ailus@linux.intel.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] media: videobuf2-core: Fix one __qbuf_dmabuf() error path
2015-12-09 8:25 ` Sakari Ailus
@ 2015-12-10 4:33 ` Wu, Xia
0 siblings, 0 replies; 3+ messages in thread
From: Wu, Xia @ 2015-12-10 4:33 UTC (permalink / raw)
To: Sakari Ailus, Linux Media Mailing List
Cc: mchehab, horms+renesas, laurent.pinchart, Hans Verkuil
Hi, Sakari,
On Wed, Dec 09, 2015 at 4:26PM, Sakari wrote:
> Hi Wu,
>
> Wu, Xia wrote:
> > 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>
> > ---
> > drivers/media/v4l2-core/videobuf2-core.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/media/v4l2-core/videobuf2-core.c
> > b/drivers/media/v4l2-core/videobuf2-core.c
> > index 33bdd81..1f232e7 100644
> > --- a/drivers/media/v4l2-core/videobuf2-core.c
> > +++ b/drivers/media/v4l2-core/videobuf2-core.c
> > @@ -1084,6 +1084,7 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb,
> const void *pb)
> > if (planes[plane].length < q->plane_sizes[plane]) {
> > dprintk(1, "invalid dmabuf length for plane %d\n",
> > plane);
> > + dma_buf_put(dbuf);
> > ret = -EINVAL;
> > goto err;
> > }
>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
> Looks like the bug has been also in the original implementation, and the code
> has been in a bit of flux since, yet the bug has remained...
>
> I think it'd be nice to have this in stable kernels. Mauro, Hans, what do you
> think?
Thank you for your feedback. Yes, it seems that the bug is there for a long time.
It's better to have this fix in stable kernels.
>
> --
> Kind regards,
>
> Sakari Ailus
> sakari.ailus@linux.intel.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-10 4:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 7:26 [PATCH] media: videobuf2-core: Fix one __qbuf_dmabuf() error path Wu, Xia
2015-12-09 8:25 ` Sakari Ailus
2015-12-10 4:33 ` Wu, Xia
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.