media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION
authorAlexander Stein <alexander.stein@ew.tq-group.com>
Tue, 21 Mar 2023 07:27:07 +0000 (08:27 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 11 Apr 2023 16:11:53 +0000 (18:11 +0200)
This device only supports video capture, so bail out if invalid
selection type is passed.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/nxp/imx7-media-csi.c

index af4a2df780e3beb3e5a2f92ab356344246922bc7..b701e823436a88ae0f5e1ed904eec5e278f3d96d 100644 (file)
@@ -1214,6 +1214,9 @@ static int imx7_csi_video_g_selection(struct file *file, void *fh,
 {
        struct imx7_csi *csi = video_drvdata(file);
 
+       if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+               return -EINVAL;
+
        switch (s->target) {
        case V4L2_SEL_TGT_COMPOSE:
        case V4L2_SEL_TGT_COMPOSE_DEFAULT: