Netdev List
 help / color / mirror / Atom feed
From: Edward Cree <ecree.xilinx@gmail.com>
To: Rand Deeb <rand.sec96@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	netdev@vger.kernel.org, linux-net-drivers@amd.com,
	linux-kernel@vger.kernel.org, deeb.rand@confident.ru,
	lvc-project@linuxtesting.org, shda@confident.ru
Subject: Re: [PATCH net] sfc: fix NULL pointer dereference in efx_tc_flower_replace_foreign()
Date: Thu, 15 Oct 2026 02:14:37 +0100	[thread overview]
Message-ID: <401073e5-6f35-4230-8734-2428e188993f@gmail.com> (raw)
In-Reply-To: <20261014145800.726-1-rand.sec96@gmail.com>

On 14/10/2026 15:58, Rand Deeb wrote:
> efx_tc_flower_replace_foreign() walks the rule's actions with an 'act'
> cursor. After a redirect action it adds the action set to the rule and
> sets the cursor to NULL:
> 
> 	list_add_tail(&act->list, &rule->acts.list);
> 	act = NULL;
> 	if (fa->id == FLOW_ACTION_REDIRECT)
> 		break; /* end of the line */
> 
> The break only leaves the switch statement, so flow_action_for_each()
> carries on with the next action while act is NULL. A following redirect
> or mirred action then does "save = *act", and a following tunnel decap
> action passes act to efx_tc_flower_action_order_ok(), which reads
> act->decap. Both dereference a NULL pointer.
> 
> The loop is missing the check that efx_tc_flower_replace() performs at
> the start of every iteration for the same cursor: reject the rule if an
> action follows a non-pipe action. The foreign variant was added without
> it.
> 
> As a result, a TC flower rule on a tunnel netdevice that redirects to an
> sfc representor and lists another redirect, mirred or tunnel decap
> action after the first redirect causes a kernel NULL pointer
> dereference. It happens in the context of the task adding the filter,
> with efx->tc->mutex held. Adding such a rule requires CAP_NET_ADMIN.
> 
> Add the same check at the top of the action loop in
> efx_tc_flower_replace_foreign(), returning -EINVAL with the same extack
> message as efx_tc_flower_replace(). The release path already copes with
> act being NULL.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 17654d84b47c ("sfc: add offloading of 'foreign' TC (decap) rules")
> Signed-off-by: Rand Deeb <rand.sec96@gmail.com>

Diagnosis and fix look correct to me.
Acked-by: Edward Cree <ecree.xilinx@gmail.com>

Sadly I don't have a working ef100 to test this on.

      parent reply	other threads:[~2026-10-15  1:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 14:58 [PATCH net] sfc: fix NULL pointer dereference in efx_tc_flower_replace_foreign() Rand Deeb
2026-10-14 15:12 ` netdev-bot+sinfo
2026-10-15  1:14 ` Edward Cree [this message]

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=401073e5-6f35-4230-8734-2428e188993f@gmail.com \
    --to=ecree.xilinx@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=deeb.rand@confident.ru \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net-drivers@amd.com \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rand.sec96@gmail.com \
    --cc=shda@confident.ru \
    /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