All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del
@ 2026-11-13 14:22 Bulatov Mark
  2026-11-15 21:47 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Bulatov Mark @ 2026-11-13 14:22 UTC (permalink / raw)
  To: Niklas Söderlund, Chaoyong He; +Cc: dev, stable, Mark Bulatov

From: Mark Bulatov <ms.bulatov7@gmail.com>

If the search fails, it leads to a null pointer dereference when attempting
to initialize nfp_mac_idx.

Fix this by adding a check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: d3c33bdf1f ("net/nfp: prepare for IPv4 UDP tunnel decap flow action")
Cc: stable@dpdk.org

Signed-off-by: Mark Bulatov <ms.bulatov7@gmail.com>
---
 drivers/net/nfp/flower/nfp_flower_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index ad0fe9a8ef..b70f24c1fb 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -3828,6 +3828,13 @@ nfp_pre_tun_table_check_del(struct nfp_flower_representor *repr,
 	}
 
 	nfp_flow_meta = nfp_flow->payload.meta;
+
+	if (find_entry == NULL) {
+		PMD_DRV_LOG(ERR, "Pre-tunnel table search failed.");
+		ret = -EINVAL;
+		goto free_entry;
+	}
+
 	nfp_mac_idx = (find_entry->mac_index << 8) |
 			NFP_FLOWER_CMSG_PORT_TYPE_OTHER_PORT |
 			NFP_TUN_PRE_TUN_IDX_BIT;
-- 
2.39.5


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

* Re: [PATCH] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del
  2026-11-13 14:22 [PATCH] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del Bulatov Mark
@ 2026-11-15 21:47 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-15 21:47 UTC (permalink / raw)
  To: Bulatov Mark; +Cc: Niklas Söderlund, Chaoyong He, dev, stable

On Fri, 13 Nov 2026 17:22:07 +0300
Bulatov Mark <ms.bulatov7@gmail.com> wrote:

> From: Mark Bulatov <ms.bulatov7@gmail.com>
> 
> If the search fails, it leads to a null pointer dereference when attempting
> to initialize nfp_mac_idx.
> 
> Fix this by adding a check.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: d3c33bdf1f ("net/nfp: prepare for IPv4 UDP tunnel decap flow action")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mark Bulatov <ms.bulatov7@gmail.com>
> ---

AI review feedback

[PATCH] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del

Error: find_entry is still uninitialized on one path.

  find_entry is only assigned inside the loop, and only for indexes
  where pre_tun_bitmap[i] != 0. If no bit is set, the loop never
  calls nfp_pre_tun_table_search() and the new NULL check reads an
  uninitialized pointer. The subject says "fix uninit local var" but
  the patch does not initialize anything. Initialize it:

	struct nfp_pre_tun_entry *find_entry = NULL;

  With that, the added check covers both the "nothing searched" and
  "nothing found" cases.

Warning: Fixes tag needs a 12 character hash:

	Fixes: d3c33bdf1f18 ("net/nfp: prepare for IPv4 UDP tunnel decap flow action")

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

end of thread, other threads:[~2026-11-15 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 14:22 [PATCH] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del Bulatov Mark
2026-11-15 21:47 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.