]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
vhost: forbid change vq groups ASID if DRIVER_OK is set
authorEugenio Pérez <eperezma@redhat.com>
Mon, 19 Jan 2026 14:32:59 +0000 (15:32 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 28 Jan 2026 20:32:17 +0000 (15:32 -0500)
Only vdpa_sim support it.  Forbid this behaviour as there is no use for
it right now, we can always enable it in the future with a feature flag.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260119143306.1818855-7-eperezma@redhat.com>

drivers/vhost/vdpa.c

index 9d25b735b43dd34d31f83d14ed7bf84132f831e1..3f0184d42075cf1d858462c82dc66e077cfcbf32 100644 (file)
@@ -682,6 +682,8 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
                        return -EFAULT;
                if (idx >= vdpa->ngroups || s.num >= vdpa->nas)
                        return -EINVAL;
+               if (ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)
+                       return -EBUSY;
                if (!ops->set_group_asid)
                        return -EOPNOTSUPP;
                return ops->set_group_asid(vdpa, idx, s.num);