From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Eugenio Pérez" <eperezma@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
kvm@vger.kernel.org, virtualization@lists.linux.dev,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] vhost-vdpa: Set s.num in GET_VRING_GROUP
Date: Sat, 27 Sep 2025 15:25:34 +0300 [thread overview]
Message-ID: <aNfXvrK5EWIL3avR@stanley.mountain> (raw)
The group is supposed to be copied to the user, but it wasn't assigned
until after the copy_to_user(). Move the "s.num = group;" earlier.
Fixes: ffc3634b6696 ("vduse: add vq group support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
This goes through the kvm tree I think.
drivers/vhost/vdpa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 6305382eacbb..25ab4d06e559 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -667,9 +667,9 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
group = ops->get_vq_group(vdpa, idx);
if (group >= vdpa->ngroups || group > U32_MAX || group < 0)
return -EIO;
- else if (copy_to_user(argp, &s, sizeof(s)))
- return -EFAULT;
s.num = group;
+ if (copy_to_user(argp, &s, sizeof(s)))
+ return -EFAULT;
return 0;
}
case VHOST_VDPA_GET_VRING_DESC_GROUP:
--
2.51.0
next reply other threads:[~2025-09-27 12:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-27 12:25 Dan Carpenter [this message]
2025-09-27 12:32 ` [PATCH] vhost-vdpa: Set s.num in GET_VRING_GROUP Michael S. Tsirkin
2025-09-29 6:04 ` Eugenio Perez Martin
2025-09-29 6:05 ` Eugenio Perez Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aNfXvrK5EWIL3avR@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox