[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YhdHi4wHLjUfD3WN@stefanha-x1.localdomain>
Date: Thu, 24 Feb 2022 08:53:31 +0000
From: Stefan Hajnoczi <stefanha@...hat.com>
To: Stefano Garzarella <sgarzare@...hat.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>, netdev@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
syzbot+1e3ea63db39f2b4440e0@...kaller.appspotmail.com,
kvm@...r.kernel.org, Anirudh Rayabharam <mail@...rudhrb.com>,
syzbot+3140b17cb44a7b174008@...kaller.appspotmail.com,
linux-kernel@...r.kernel.org,
Mike Christie <michael.christie@...cle.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
stable@...r.kernel.org
Subject: Re: [PATCH v2] vhost/vsock: don't check owner in vhost_vsock_stop()
while releasing
On Tue, Feb 22, 2022 at 10:47:42AM +0100, Stefano Garzarella wrote:
> 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@...r.kernel.org
> Reported-by: syzbot+1e3ea63db39f2b4440e0@...kaller.appspotmail.com
> Reported-and-tested-by: syzbot+3140b17cb44a7b174008@...kaller.appspotmail.com
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
> ---
> v2:
> - initialized `ret` in vhost_vsock_stop [Dan]
> - added comment about vhost_vsock_stop() calling in the code and an explanation
> in the commit message [MST]
>
> v1: https://lore.kernel.org/virtualization/20220221114916.107045-1-sgarzare@redhat.com
> ---
> drivers/vhost/vsock.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@...hat.com>
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists