From: "Michael S. Tsirkin" <mst@redhat.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Eugenio Pérez" <eperezma@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: Re: [PATCH] vhost-vdpa: Set s.num in GET_VRING_GROUP
Date: Sat, 27 Sep 2025 08:32:20 -0400 [thread overview]
Message-ID: <20250927083043-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <aNfXvrK5EWIL3avR@stanley.mountain>
On Sat, Sep 27, 2025 at 03:25:34PM +0300, Dan Carpenter wrote:
> 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.
Thanks for the patch!
IIUC this was in my tree for next, but more testing
and review found issues (like this one) so I dropped it for now.
> 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 prev parent reply other threads:[~2025-09-27 12:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-27 12:25 [PATCH] vhost-vdpa: Set s.num in GET_VRING_GROUP Dan Carpenter
2025-09-27 12:32 ` Michael S. Tsirkin [this message]
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=20250927083043-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=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=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;
as well as URLs for NNTP newsgroup(s).