]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/6.1.83/vdpa_sim-reset-must-not-run.patch
Linux 6.1.83
[thirdparty/kernel/stable-queue.git] / releases / 6.1.83 / vdpa_sim-reset-must-not-run.patch
CommitLineData
41193d5a
SL
1From f3a17153b46ee70eada6dd86ca35720ac0b84994 Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Fri, 9 Feb 2024 14:30:07 -0800
4Subject: vdpa_sim: reset must not run
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9From: Steve Sistare <steven.sistare@oracle.com>
10
11[ Upstream commit 9588e7fc511f9c55b9835f14916e90ab940061b7 ]
12
13vdpasim_do_reset sets running to true, which is wrong, as it allows
14vdpasim_kick_vq to post work requests before the device has been
15configured. To fix, do not set running until VIRTIO_CONFIG_S_DRIVER_OK
16is set.
17
18Fixes: 0c89e2a3a9d0 ("vdpa_sim: Implement suspend vdpa op")
19Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
20Reviewed-by: Eugenio PĂ©rez <eperezma@redhat.com>
21Acked-by: Jason Wang <jasowang@redhat.com>
22Message-Id: <1707517807-137331-1-git-send-email-steven.sistare@oracle.com>
23Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
24Signed-off-by: Sasha Levin <sashal@kernel.org>
25---
26 drivers/vdpa/vdpa_sim/vdpa_sim.c | 3 ++-
27 1 file changed, 2 insertions(+), 1 deletion(-)
28
29diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
30index 61bde476cf9c8..e7fc25bfdd237 100644
31--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
32+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
33@@ -120,7 +120,7 @@ static void vdpasim_do_reset(struct vdpasim *vdpasim)
34 for (i = 0; i < vdpasim->dev_attr.nas; i++)
35 vhost_iotlb_reset(&vdpasim->iommu[i]);
36
37- vdpasim->running = true;
38+ vdpasim->running = false;
39 spin_unlock(&vdpasim->iommu_lock);
40
41 vdpasim->features = 0;
42@@ -513,6 +513,7 @@ static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status)
43
44 spin_lock(&vdpasim->lock);
45 vdpasim->status = status;
46+ vdpasim->running = (status & VIRTIO_CONFIG_S_DRIVER_OK) != 0;
47 spin_unlock(&vdpasim->lock);
48 }
49
50--
512.43.0
52