]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
vhost: add vsock compat ioctl
authorSonny Rao <sonnyrao@chromium.org>
Wed, 14 Mar 2018 21:36:25 +0000 (14:36 -0700)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 20 Mar 2018 01:17:42 +0000 (03:17 +0200)
This will allow usage of vsock from 32-bit binaries on a 64-bit
kernel.

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vsock.c

index 0d14e2ff19f16b18a2babdc3107f6ae7d1f35a9f..ee0c385d9fe54b865a4b26d0301ff9e221f12be9 100644 (file)
@@ -699,12 +699,23 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl,
        }
 }
 
+#ifdef CONFIG_COMPAT
+static long vhost_vsock_dev_compat_ioctl(struct file *f, unsigned int ioctl,
+                                        unsigned long arg)
+{
+       return vhost_vsock_dev_ioctl(f, ioctl, (unsigned long)compat_ptr(arg));
+}
+#endif
+
 static const struct file_operations vhost_vsock_fops = {
        .owner          = THIS_MODULE,
        .open           = vhost_vsock_dev_open,
        .release        = vhost_vsock_dev_release,
        .llseek         = noop_llseek,
        .unlocked_ioctl = vhost_vsock_dev_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = vhost_vsock_dev_compat_ioctl,
+#endif
 };
 
 static struct miscdevice vhost_vsock_misc = {