media: v4l2-core: zero field base in struct v4l2_framebuffer
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 2 Mar 2023 12:57:30 +0000 (13:57 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 19 Mar 2023 23:32:56 +0000 (00:32 +0100)
Make sure this field is always 0 since destructive overlays
are no longer supported.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
drivers/media/v4l2-core/v4l2-ioctl.c

index e7baa28..f3bed37 100644 (file)
@@ -587,14 +587,11 @@ struct v4l2_framebuffer32 {
 static int get_v4l2_framebuffer32(struct v4l2_framebuffer *p64,
                                  struct v4l2_framebuffer32 __user *p32)
 {
-       compat_caddr_t tmp;
-
-       if (get_user(tmp, &p32->base) ||
-           get_user(p64->capability, &p32->capability) ||
+       if (get_user(p64->capability, &p32->capability) ||
            get_user(p64->flags, &p32->flags) ||
            copy_from_user(&p64->fmt, &p32->fmt, sizeof(p64->fmt)))
                return -EFAULT;
-       p64->base = (void __force *)compat_ptr(tmp);
+       p64->base = NULL;
 
        return 0;
 }
index 2af826f..caeed2e 100644 (file)
@@ -2060,6 +2060,15 @@ static int v4l_s_hw_freq_seek(const struct v4l2_ioctl_ops *ops,
        return ops->vidioc_s_hw_freq_seek(file, fh, p);
 }
 
+static int v4l_s_fbuf(const struct v4l2_ioctl_ops *ops,
+                     struct file *file, void *fh, void *arg)
+{
+       struct v4l2_framebuffer *p = arg;
+
+       p->base = NULL;
+       return ops->vidioc_s_fbuf(file, fh, p);
+}
+
 static int v4l_overlay(const struct v4l2_ioctl_ops *ops,
                                struct file *file, void *fh, void *arg)
 {
@@ -2779,7 +2788,6 @@ struct v4l2_ioctl_info {
        }
 
 DEFINE_V4L_STUB_FUNC(g_fbuf)
-DEFINE_V4L_STUB_FUNC(s_fbuf)
 DEFINE_V4L_STUB_FUNC(expbuf)
 DEFINE_V4L_STUB_FUNC(g_std)
 DEFINE_V4L_STUB_FUNC(g_audio)
@@ -2813,7 +2821,7 @@ static const struct v4l2_ioctl_info v4l2_ioctls[] = {
        IOCTL_INFO(VIDIOC_REQBUFS, v4l_reqbufs, v4l_print_requestbuffers, INFO_FL_PRIO | INFO_FL_QUEUE),
        IOCTL_INFO(VIDIOC_QUERYBUF, v4l_querybuf, v4l_print_buffer, INFO_FL_QUEUE | INFO_FL_CLEAR(v4l2_buffer, length)),
        IOCTL_INFO(VIDIOC_G_FBUF, v4l_stub_g_fbuf, v4l_print_framebuffer, 0),
-       IOCTL_INFO(VIDIOC_S_FBUF, v4l_stub_s_fbuf, v4l_print_framebuffer, INFO_FL_PRIO),
+       IOCTL_INFO(VIDIOC_S_FBUF, v4l_s_fbuf, v4l_print_framebuffer, INFO_FL_PRIO),
        IOCTL_INFO(VIDIOC_OVERLAY, v4l_overlay, v4l_print_u32, INFO_FL_PRIO),
        IOCTL_INFO(VIDIOC_QBUF, v4l_qbuf, v4l_print_buffer, INFO_FL_QUEUE),
        IOCTL_INFO(VIDIOC_EXPBUF, v4l_stub_expbuf, v4l_print_exportbuffer, INFO_FL_QUEUE | INFO_FL_CLEAR(v4l2_exportbuffer, flags)),