From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Yunjian Wang <wangyunjian@huawei.com>, dev@dpdk.org
Cc: chenbox@nvidia.com, cheng1.jiang@intel.com,
jerry.lilijun@huawei.com, stable@dpdk.org
Subject: Re: [PATCH 1/1] vhost: fix missing descriptor chains length checks
Date: Tue, 4 Mar 2025 13:29:39 +0100 [thread overview]
Message-ID: <ccf69088-44cf-4f8e-bfc8-283d3a4a3ddf@redhat.com> (raw)
In-Reply-To: <0bf28cc647eac66343c39d6acd4df868836e6ae6.1734923187.git.wangyunjian@huawei.com>
On 12/23/24 4:29 AM, Yunjian Wang wrote:
> The descriptor chains length must be greater than the Virtio-net
> header size. Otherwise, such descriptor chains sizes implies no
> packet data.
>
> Fixes: fe8477ebbd94 ("vhost: support async packed ring dequeue")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
> lib/vhost/virtio_net.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
> index 69901ab3b5..8fc9bfa056 100644
> --- a/lib/vhost/virtio_net.c
> +++ b/lib/vhost/virtio_net.c
> @@ -3962,6 +3962,16 @@ virtio_dev_tx_async_single_packed(struct virtio_net *dev,
> VHOST_ACCESS_RO) < 0))
> return -1;
>
> + if (unlikely(buf_len <= dev->vhost_hlen)) {
> + if (!allocerr_warned) {
> + VHOST_DATA_LOG(dev->ifname, ERR, "Invalid buffer length.");
> + allocerr_warned = true;
> + }
> + return -1;
> + }
> +
> + buf_len -= dev->vhost_hlen;
> +
> if (unlikely(virtio_dev_pktmbuf_prep(dev, pkts, buf_len))) {
> if (!allocerr_warned) {
> VHOST_DATA_LOG(dev->ifname, ERR, "Failed mbuf alloc of size %d from %s.",
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
next prev parent reply other threads:[~2025-03-04 12:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-23 3:29 Yunjian Wang
2025-03-04 12:29 ` Maxime Coquelin [this message]
2025-03-04 13:42 ` Maxime Coquelin
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=ccf69088-44cf-4f8e-bfc8-283d3a4a3ddf@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=cheng1.jiang@intel.com \
--cc=dev@dpdk.org \
--cc=jerry.lilijun@huawei.com \
--cc=stable@dpdk.org \
--cc=wangyunjian@huawei.com \
/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).