#syz test:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
diff --git a/drivers/media/usb/em28xx/em28xx-video.c
b/drivers/media/usb/em28xx/em28xx-video.c
index 8181c0e6a25b..900a1eacb1c7 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2320,6 +2320,19 @@ static int em28xx_v4l2_close(struct file *filp)
return 0;
}
+/* Used to temporarily disable file operations on video_device until successful
+ * initialization in em28xx_v4l2_init().
+ */
+static const struct v4l2_file_operations em28xx_v4l_fops_empty = {
+ .owner = THIS_MODULE,
+ .open = NULL,
+ .release = NULL,
+ .read = NULL,
+ .poll = NULL,
+ .mmap = NULL,
+ .unlocked_ioctl = NULL,
+};
+
static const struct v4l2_file_operations em28xx_v4l_fops = {
:...skipping...
diff --git a/drivers/media/usb/em28xx/em28xx-video.c
b/drivers/media/usb/em28xx/em28xx-video.c
index 8181c0e6a25b..900a1eacb1c7 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -2320,6 +2320,19 @@ static int em28xx_v4l2_close(struct file *filp)
return 0;
}
+/* Used to temporarily disable file operations on video_device until successful
+ * initialization in em28xx_v4l2_init().
+ */
+static const struct v4l2_file_operations em28xx_v4l_fops_empty = {
+ .owner = THIS_MODULE,
+ .open = NULL,
+ .release = NULL,
+ .read = NULL,
+ .poll = NULL,
+ .mmap = NULL,
+ .unlocked_ioctl = NULL,
+};
+
static const struct v4l2_file_operations em28xx_v4l_fops = {
.owner = THIS_MODULE,
.open = em28xx_v4l2_open,
@@ -2375,12 +2388,22 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
};
static const struct video_device em28xx_video_template = {
- .fops = &em28xx_v4l_fops,
+ .fops = &em28xx_v4l_fops_empty,
.ioctl_ops = &video_ioctl_ops,
.release = video_device_release_empty,
.tvnorms = V4L2_STD_ALL,
};
+/* Used to temporarily disable file operations on video_device until successful
+ * initialization in em28xx_v4l2_init().
+ */
+static const struct v4l2_file_operations radio_fops_empty = {
+ .owner = THIS_MODULE,
+ .open = NULL,
+ .release = NULL,
+ .unlocked_ioctl = NULL,
+};
+
static const struct v4l2_file_operations radio_fops = {
.owner = THIS_MODULE,
.open = em28xx_v4l2_open,
@@ -2404,7 +2427,7 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = {
};
static struct video_device em28xx_radio_template = {
- .fops = &radio_fops,
+ .fops = &radio_fops_empty,
.ioctl_ops = &radio_ioctl_ops,
.release = video_device_release_empty,
};
@@ -2833,9 +2856,6 @@ static int em28xx_v4l2_init(struct em28xx *dev)
"can't register radio device\n");
goto unregister_dev;
}