summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-05-29 11:37:30 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2023-06-09 15:28:29 +0100
commit566f6de6aa283be619e870fae175404b447cdee1 (patch)
treedcd9bc62a39507449bbdd65dc8a281ef1791a968 /drivers/staging
parent7caa6570da6a21973340edf4075f31a59f08187a (diff)
downloadlinux-stable-566f6de6aa283be619e870fae175404b447cdee1.tar.gz
linux-stable-566f6de6aa283be619e870fae175404b447cdee1.tar.bz2
linux-stable-566f6de6aa283be619e870fae175404b447cdee1.zip
media: atomisp: Add target validation to atomisp_subdev_set_selection()
As the 2 comments in the function already say both the sink and the source pads only support setting the selection for 1 target: /* Only crop target supported on sink pad. */ /* Only compose target is supported on source pads. */ Validate that the passed in target actually matches these expectations. Link: https://lore.kernel.org/r/20230529103741.11904-11-hdegoede@redhat.com Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_subdev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
index 7985a0319a39..04e257ede7d4 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
@@ -360,6 +360,10 @@ int atomisp_subdev_set_selection(struct v4l2_subdev *sd,
unsigned int padding_w = pad_w;
unsigned int padding_h = pad_h;
+ if ((pad == ATOMISP_SUBDEV_PAD_SINK && target != V4L2_SEL_TGT_CROP) ||
+ (pad == ATOMISP_SUBDEV_PAD_SOURCE && target != V4L2_SEL_TGT_COMPOSE))
+ return -EINVAL;
+
isp_get_fmt_rect(sd, sd_state, which, ffmt, crop, comp);
dev_dbg(isp->dev,