DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] vhost: add sanity check for resubmiting reqs in split ring
@ 2021-08-27  5:12 Li Feng
  2021-09-01  5:01 ` Li Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Li Feng @ 2021-08-27  5:12 UTC (permalink / raw)
  To: Maxime Coquelin, Chenbo Xia; +Cc: dev, Li Feng

When getting reqs from the avail ring, the id may exceed inflight
queue size. Then the dpdk will crash forever.

Signed-off-by: Li Feng <fengli@smartx.com>
---
 lib/vhost/vhost_user.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 29a4c9af60..f09d0f6a48 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -1823,8 +1823,14 @@ vhost_check_queue_inflights_split(struct virtio_net *dev,
 	last_io = inflight_split->last_inflight_io;
 
 	if (inflight_split->used_idx != used->idx) {
-		inflight_split->desc[last_io].inflight = 0;
-		rte_atomic_thread_fence(__ATOMIC_SEQ_CST);
+		if (unlikely(last_io >= inflight_split->desc_num)) {
+			VHOST_LOG_CONFIG(ERR, "last_inflight_io '%"PRIu16"' exceeds inflight "
+				"queue size (%"PRIu16").\n", last_io,
+				inflight_split->desc_num);
+		} else {
+			inflight_split->desc[last_io].inflight = 0;
+			rte_atomic_thread_fence(__ATOMIC_SEQ_CST);
+		}
 		inflight_split->used_idx = used->idx;
 	}
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-10-21 12:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27  5:12 [dpdk-dev] [PATCH v1] vhost: add sanity check for resubmiting reqs in split ring Li Feng
2021-09-01  5:01 ` Li Feng
2021-10-14  8:17 ` Maxime Coquelin
2021-10-14  8:25   ` Maxime Coquelin
2021-10-14  8:28     ` Xia, Chenbo
2021-10-18  1:01       ` Liu, Changpeng
2021-10-14 11:25   ` Li Feng
2021-10-14 11:38     ` Maxime Coquelin
2021-10-14 11:54       ` Li Feng
2021-10-14 12:40 ` [dpdk-dev] [PATCH v2] vhost: add sanity check when operating the " Li Feng
2021-10-15  8:51   ` Maxime Coquelin
2021-10-15  9:25     ` Li Feng
2021-10-21 12:32       ` Maxime Coquelin

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).