[3.13.y.z extended stable] Patch "[media] vb2: fix plane index sanity check in vb2_plane_cookie()" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu Oct 9 20:51:42 UTC 2014

This is a note to let you know that I have just added a patch titled

    [media] vb2: fix plane index sanity check in vb2_plane_cookie()

to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree 
which can be found at:


This patch is scheduled to be released in version

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y.z tree, see



>From a8e30bcb2d218f515ba3ca2b9a4189d6707cb44d Mon Sep 17 00:00:00 2001
From: Zhaowei Yuan <zhaowei.yuan at samsung.com>
Date: Thu, 21 Aug 2014 23:28:21 -0300
Subject: [media] vb2: fix plane index sanity check in vb2_plane_cookie()

commit a9ae4692eda4b99f85757b15d60971ff78a0a0e2 upstream.

It's also invalid when plane_no is equal to vb->num_planes

Signed-off-by: Zhaowei Yuan <zhaowei.yuan at samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil at cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab at osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
 drivers/media/v4l2-core/videobuf2-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 0edc165..7db9b5b 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -885,7 +885,7 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no)
 	struct vb2_queue *q = vb->vb2_queue;

-	if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv)
+	if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv)
 		return NULL;

 	return call_memop(q, cookie, vb->planes[plane_no].mem_priv);

More information about the kernel-team mailing list