OSDN Git Service

msm: ais: Return -NOTTY on invalid ioctl command
authorRahul Sharma <sharah@codeaurora.org>
Fri, 8 Sep 2017 13:21:43 +0000 (18:51 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Mon, 11 Sep 2017 07:11:06 +0000 (00:11 -0700)
Check validity of command before processing.

Change-Id: Iecd66b90922f8ed4b7d8d50f7c3d7f27d5d93309
CR-fixed: 2083314
Signed-off-by: Rahul Sharma <sharah@codeaurora.org>
drivers/media/platform/msm/ais/msm.c

index a3a7421..ccfdfba 100644 (file)
@@ -731,6 +731,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;