]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
vhost/vsock: don't check owner in vhost_vsock_stop() while releasing
authorStefano Garzarella <sgarzare@redhat.com>
Tue, 22 Feb 2022 09:47:42 +0000 (10:47 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 7 Mar 2022 10:45:52 +0000 (11:45 +0100)
commitff0c7b54f634f4cc0ba5b1cb7faa8dd7e3fc60ca
treeef6661f944172d0ed5914fffc95bfad9cc868387
parentb2a2f8038255f6e054fe617c786541758b2a0ba1
vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

BugLink: https://bugs.launchpad.net/bugs/1963891
commit a58da53ffd70294ebea8ecd0eb45fd0d74add9f9 upstream.

vhost_vsock_stop() calls vhost_dev_check_owner() to check the device
ownership. It expects current->mm to be valid.

vhost_vsock_stop() is also called by vhost_vsock_dev_release() when
the user has not done close(), so when we are in do_exit(). In this
case current->mm is invalid and we're releasing the device, so we
should clean it anyway.

Let's check the owner only when vhost_vsock_stop() is called
by an ioctl.

When invoked from release we can not fail so we don't check return
code of vhost_vsock_stop(). We need to stop vsock even if it's not
the owner.

Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko")
Cc: stable@vger.kernel.org
Reported-by: syzbot+1e3ea63db39f2b4440e0@syzkaller.appspotmail.com
Reported-and-tested-by: syzbot+3140b17cb44a7b174008@syzkaller.appspotmail.com
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/vhost/vsock.c