aboutsummaryrefslogtreecommitdiffstats
path: root/patches.renesas/0224-media-media-rcar_vin-Reject-videobufs-that-are-too-s.patch
blob: 5c3bdbda6d07faacce7ffc664e66ded16390a665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From d53f96c8a5fc89ee531ece2913391cd45f1a13c0 Mon Sep 17 00:00:00 2001
From: Rob Taylor <rob.taylor@codethink.co.uk>
Date: Thu, 23 Jul 2015 09:21:43 -0300
Subject: [PATCH 224/326] [media] media: rcar_vin: Reject videobufs that are
 too small for current format

In videobuf_setup reject buffers that are too small for the configured
format. Fixes v4l2-compliance issue.

Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
Reviewed-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
(cherry picked from commit 4284118058b2b4f217a050908a555d0e1ed58641)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/media/platform/soc_camera/rcar_vin.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index 1f080241c2e0..2d8cb52188e6 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -541,6 +541,9 @@ static int rcar_vin_videobuf_setup(struct vb2_queue *vq,
 		unsigned int bytes_per_line;
 		int ret;
 
+		if (fmt->fmt.pix.sizeimage < icd->sizeimage)
+			return -EINVAL;
+
 		xlate = soc_camera_xlate_by_fourcc(icd,
 						   fmt->fmt.pix.pixelformat);
 		if (!xlate)
-- 
2.6.2