Subject: [PATCH] V4L: check inval in video_register_device_index()

From: Henrik Kretzschmar <[email protected]>
Signed-off-by: Henrik Kretzschmar <[email protected]>

Better check the video_device pointer before using it.


diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 6f36006..ef153ff 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -257,6 +257,9 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
int ret;
char *name_base;

+ if (vfd == NULL)
+ return -EINVAL;
+
switch (type) {
case VFL_TYPE_GRABBER:
base = MINOR_VFL_TYPE_GRABBER_MIN;