OSDN Git Service

msm: camera: Return -NOTTY on invalid ioctl command.
authorTrishansh Bhardwaj <tbhardwa@codeaurora.org>
Mon, 4 Sep 2017 05:32:14 +0000 (11:02 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Wed, 6 Sep 2017 08:49:32 +0000 (01:49 -0700)
Check validity of command before processing.

Change-Id: Icc5c57eac999b7c40fbb9505b2b88745167adc66
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
drivers/media/platform/msm/camera_v2/msm.c

index 7cfeffc..194a658 100644 (file)
@@ -746,6 +746,16 @@ static long msm_private_ioctl(struct file *file, void *fh,
        if (!event_data)
                return -EINVAL;
 
+       switch (cmd) {
+       case MSM_CAM_V4L2_IOCTL_NOTIFY:
+       case MSM_CAM_V4L2_IOCTL_CMD_ACK:
+       case MSM_CAM_V4L2_IOCTL_NOTIFY_DEBUG:
+       case MSM_CAM_V4L2_IOCTL_NOTIFY_ERROR:
+               break;
+       default:
+               return -ENOTTY;
+       }
+
        memset(&event, 0, sizeof(struct v4l2_event));
        session_id = event_data->session_id;
        stream_id = event_data->stream_id;