From: Stephen Hemminger <stephen@networkplumber.org>
To: Mark Bulatov <ms.bulatov7@gmail.com>
Cc: "Chaoyong He" <chaoyong.he@corigine.com>,
"Niklas Söderlund" <niklas.soderlund@corigine.com>,
dev@dpdk.org, stable@dpdk.org
Subject: Re: [PATCH v2] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del
Date: Tue, 17 Nov 2026 10:56:23 -0800 [thread overview]
Message-ID: <20261117105623.53dd615f@phoenix.local> (raw)
In-Reply-To: <20261116171857.5306-1-ms.bulatov7@gmail.com>
On Mon, 16 Nov 2026 20:18:56 +0300
Mark Bulatov <ms.bulatov7@gmail.com> wrote:
> 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: d3c33bdf1f18 ("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 had observations worth doing a cleanup pass to fix.
[PATCH 1/2] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del
Info: the commit message covers only half of the bug.
find_entry can reach the dereference in two states. If no
pre_tun_bitmap[] slot is set, the loop body never runs and
find_entry is uninitialized. If slots are set but none matches,
find_entry holds the NULL from the last search. pre_tun_cnt counts
entries for all representors, so pre_tun_cnt > 1 does not mean
this representor's MAC is in the table. Suggested body:
find_entry is left uninitialized if no pre-tunnel slot is in
use, and is NULL if no slot matches this representor's MAC.
Either case is then dereferenced when computing nfp_mac_idx.
Initialize find_entry and fail the delete if no entry is found.
Info: put the check directly after the search loop.
The check sits after "nfp_flow_meta = nfp_flow->payload.meta;",
which has nothing to do with it. It reads better as part of the
search:
for (i = 1; i < NFP_TUN_PRE_TUN_RULE_LIMIT; i++) {
...
}
if (find_entry == NULL) {
PMD_DRV_LOG(ERR, "Pre-tunnel table entry not found.");
ret = -EINVAL;
goto free_entry;
}
nfp_flow_meta = nfp_flow->payload.meta;
next prev parent reply other threads:[~2026-11-17 18:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 17:18 [PATCH v2] net/nfp: fix uninit local var in nfp_pre_tun_table_check_del Mark Bulatov
2026-11-17 18:56 ` Stephen Hemminger [this message]
2026-11-19 18:15 ` [PATCH v3] " Mark Bulatov
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=20261117105623.53dd615f@phoenix.local \
--to=stephen@networkplumber.org \
--cc=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=ms.bulatov7@gmail.com \
--cc=niklas.soderlund@corigine.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