]> git.baikalelectronics.ru Git - 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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Feb 2022 12:32:33 +0000 (12:32 +0000)
commite0983f272414e825fdc93792d8c2b5a4030b3094
tree674e148b37fbe2fba93917635ed65ad26470ec23
parentaf8353604690377d7953e042e11be36430df546b
vhost/vsock: don't check owner in vhost_vsock_stop() while releasing

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: 296c915921dd ("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>
drivers/vhost/vsock.c