From: Gaoxiang Liu <gaoxiangliu0@163.com>
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: dev@dpdk.org, liugaoxiang@huawei.com,
Gaoxiang Liu <gaoxiangliu0@163.com>,
stable@dpdk.org
Subject: [PATCH] vhost: fix avail idx update error when desc copy failed
Date: Wed, 22 Jun 2022 08:56:00 +0800 [thread overview]
Message-ID: <20220622005600.5920-1-gaoxiangliu0@163.com> (raw)
When copy_desc_to_mbuf function failed, i added 1.
And last_avail_idx added i, other than i - 1.
It may cause that the first mbuf in mbuf-list is dropped,
the second mbuf in mbuf-list is received in the following
rx procedure.
And The pkt_len of the second mbuf is zero, resulting in
segment fault when parsing the mbuf.
Fixes: 0fd5608ef97f ("vhost: handle mbuf allocation failure")
Cc: stable@dpdk.org
Signed-off-by: Gaoxiang Liu <liugaoxiang@huawei.com>
---
lib/vhost/virtio_net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 68a26eb17d..86f1c04b43 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2850,7 +2850,7 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
if (dropped)
rte_pktmbuf_free_bulk(&pkts[i - 1], count - i + 1);
- vq->last_avail_idx += i;
+ vq->last_avail_idx += i - 1;
do_data_copy_dequeue(vq);
if (unlikely(i < count))
--
2.32.0
next reply other threads:[~2022-06-22 0:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 0:56 Gaoxiang Liu [this message]
2022-06-22 1:19 ` [PATCH v2] " Gaoxiang Liu
2022-06-23 3:07 ` Xia, Chenbo
2022-06-23 6:23 ` Gaoxiang Liu
2022-07-01 13:05 ` Xia, Chenbo
2022-07-02 3:00 ` Gaoxiang Liu
2022-07-04 7:51 ` Xia, Chenbo
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=20220622005600.5920-1-gaoxiangliu0@163.com \
--to=gaoxiangliu0@163.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=liugaoxiang@huawei.com \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
/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).