patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] lpm: fix buffer overflow
@ 2021-10-08 21:28 Vladimir Medvedkin
  0 siblings, 0 replies; only message in thread
From: Vladimir Medvedkin @ 2021-10-08 21:28 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, david.marchand, alex, stable

This patch fixes buffer overflow reported by ASAN,
please reference

The rte_lpm6 keeps routing information for control plane purpose
inside the rte_hash table which uses rte_jhash() as a hash function.
From the rte_jhash() documentation: If input key is not aligned to
four byte boundaries or a multiple of four bytes in length,
the memory region just after may be read (but not used in the
rte_lpm6 uses 17 bytes keys consisting of IPv6 address (16 bytes) +
depth (1 byte).

This patch increases the size of the depth field up to uint32_t
and sets the alignment to 4 bytes.

Bugzilla ID: 819
Fixes: 86b3b21952a8 ("lpm6: store rules in hash table")

Signed-off-by: Vladimir Medvedkin <>
 lib/lpm/rte_lpm6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 37baabb..d5e0918 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -80,8 +80,8 @@ struct rte_lpm6_rule {
 /** Rules tbl entry key. */
 struct rte_lpm6_rule_key {
 	uint8_t ip[RTE_LPM6_IPV6_ADDR_SIZE]; /**< Rule IP address. */
-	uint8_t depth; /**< Rule depth. */
+	uint32_t depth; /**< Rule depth. */
+} __rte_aligned(sizeof(uint32_t));
 /* Header of tbl8 */
 struct rte_lpm_tbl8_hdr {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-08 21:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08 21:28 [dpdk-stable] [PATCH] lpm: fix buffer overflow Vladimir Medvedkin

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ \
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone