DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net: check that seg is valid before dereference
@ 2020-09-28 15:32 Chas Williams
  2020-09-29  3:01 ` wangyunjian
  2020-10-01 10:22 ` [dpdk-dev] [PATCH v2 1/2] " Chas Williams
  0 siblings, 2 replies; 8+ messages in thread
From: Chas Williams @ 2020-09-28 15:32 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz, Chas Williams

If the overall pkt_len and segment lengths are out of agreement,
it is possible for the seg to be NULL after the loop. Add assert
to check this condition in debug builds.

Fixes: c442fed81bb9 ("net: add function to calculate checksum in mbuf")

Signed-off-by: Chas Williams <3chas3@gmail.com>
---
 lib/librte_net/rte_ip.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index fcd1eb342..6b3e4cdda 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -225,6 +225,7 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len,
 			break;
 		off -= seglen;
 	}
+	RTE_ASSERT(seg != NULL);
 	seglen -= off;
 	buf = rte_pktmbuf_mtod_offset(seg, const char *, off);
 	if (seglen >= len) {
-- 
2.26.2


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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 15:32 [dpdk-dev] [PATCH] net: check that seg is valid before dereference Chas Williams
2020-09-29  3:01 ` wangyunjian
2020-09-29 20:19   ` Chas Williams
2020-10-01 10:22 ` [dpdk-dev] [PATCH v2 1/2] " Chas Williams
2020-10-01 10:22   ` [dpdk-dev] [PATCH v2 2/2] net/virtio: check return from rte_raw_cksum_mbuf Chas Williams
2020-10-06 21:15     ` Thomas Monjalon
2020-10-09  7:14     ` Maxime Coquelin
2020-10-12 21:15       ` Thomas Monjalon

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