🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3392

Re: [PATCH net] sfc: fix NULL pointer dereference in efx_tc_flower_replace_foreign()

#3392
From: Edward Cree
Date: Thu, 15 Oct 2026 01:14
42 lines
10292 bytes
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.
Technical Details
Message-ID: <401073e5-6f35-4230-8734-2428e188993f@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346478-linux-kernel-netdev=dewy.ru
References: <20261014145800.726-1-rand.sec96@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346478-linux-kernel-netdev=dewy.ru
From: ecree.xilinx@gmail.com (Edward Cree)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] sfc: fix NULL pointer dereference in
 efx_tc_flower_replace_foreign()
Date: Thu, 15 Oct 2026 02:14:37 +0100
Organization: Usenet Network
Message-ID: <401073e5-6f35-4230-8734-2428e188993f@gmail.com>
References: <20261014145800.726-1-rand.sec96@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2423067"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:o1+xIXtziP10n4PdY7d3B5V6aGw= sha256:nMfSp6sFsll3pgYkkAWn4YBRzqt72p9dmKKKbikeRLQ=
	sha1:hh5gfsT5bt3gJuiStoUESRFewws= sha256:BhbYeqDgy4sf7ewqN4zZBeL9Xzx2O3RlLYW7IMLhgqM=
Content-Language: en-GB
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id CE62F11020A; Thu, 15 Oct 2026 04:15:06 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.748
X-Spam-Status: No, score=-0.748 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id bcKU9o49mvzj;
	Thu, 15 Oct 2026 04:15:00 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-346478-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id C5118110008; Thu, 15 Oct 2026 04:14:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sin.lore.kernel.org (Postfix) with ESMTP id DE95324074; Thu, 15 Oct 2026 01:14:44 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 2091C3033FD;
	Thu, 15 Oct 2026 01:14:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iNs6Q0rL"
X-Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FD932F39B5
	for <netdev@vger.kernel.org>; Thu, 15 Oct 2026 01:14:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792026883; cv=none; b=n+7eydvmC8cHtDPo3uKWeUHkAQHROIR6RQZnUQm1TPGDBy/wuThbMsaVcK/K3AK+hesJOx6jGWsqnnSaVD8mfTIMubuCf/y+BOsBxzUBGX+zHTiAuyh1MnWhv1PlCDzV0k5w71UQrfTE07AccFDkVI+iE+NBtcdFHQTLH2p+wGY=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792026883; c=relaxed/simple;
	bh=a0JM3tGonG6TXjE/FanhVttaHvXzL1JEEXBVFVdzvlc=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=RzKrJ0G6VfwT1KTV2pA+m2cN9c1WkzNyIp/w0LTyFEHw55rF+HhvGXiKSAWqvb3G9pTliZjRUqrJx/B/fuysNLfqcN4Axm5gLp/168O9ETNmbczS1j9N8bm7yyO83SfX5+2W7meRXD2KZTbcNxzMmlp6YhdkhaH4K0DY4D2+hWA=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iNs6Q0rL; arc=none smtp.client-ip=209.85.128.52
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4a022fee0caso44171015e9.1
        for <netdev@vger.kernel.org>; Wed, 14 Oct 2026 18:14:41 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792026880; x=1792631680; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=TITPVJDihb8Q06oVMdVjVp/hCUi1JQZf8N1TzMREhjc=;
        b=iNs6Q0rLRlUqyPdel4mXa7w3Gsq6fO3j3Hc7vdUgQ1MjqmB5x6j5L5SIbzipUWXZF5
         iU9DYOhOo5HKNID6wiTgLrOZgoYcMliCH0HMpOCuZQMNAMyVSaFdKFyheWyf3ZQwbInU
         B8x+CEOokgbvfHeamkrkTwd5XR6Ajibzu+idWLVPyz1KQfaROp2FkrI4/pLH6V7jJDZR
         TeyXrhIOscmHSIvwT2yEYMcBBoQ8a5WjSsG3N1U0p3z14HzyGVtIPowjyWWVF9cY3N8p
         ozu+iFl0YUJVIBVsJfh+8lSqwtd/2uWhSMm3Gnd1jYJmQx5pd4en2JzSiAZeoGQ6kvo7
         PvxA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792026880; x=1792631680;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=TITPVJDihb8Q06oVMdVjVp/hCUi1JQZf8N1TzMREhjc=;
        b=qzJyZcHLlZ9hED6wqB0g9WRRgKrCtYFnto4LfXicK2d92xlkSzC3kH82AjNkHH2+xF
         SIjtF8lMdO0yCvotZOw7Ruj/dDYepAOIK+PV6zbxKny7c6oC1zZaLg66T9CqyOW3MYjt
         DWRemuD6rE7OY2vyH2nSJynGqZgTc1cyL05oBKAxyGahZL3KIt019be/XV82UdFNPE0D
         aGgemcjsL2awvMZHC7f9fi1ku82QvYDtfm8eaccS2V7WXLsD2rjYA8f8PjWfycFcQKUI
         5XgVBDUZsJBl0XlqVNXtyt6uPg0xeleNgQEwlM2vOJgPUkcL8A+vS083/cuLCAg1rUJZ
         KAMw==
X-Forwarded-Encrypted: i=1; AKwUvBx/3eE11fyX5eFj2tSDt1eMTnYMubQe8WzDBX3NniTM7c9of/ji/TISnGLFDYRj4gwQ0Ut0kXk=@vger.kernel.org
X-Gm-Message-State: AFq9FYJPRu1zRMD1ffStPd1/43ANulWWT42CqdJI7VGN5JpwxnR8CmL1
	dZmnmNrkVLHf+SDnRayXkAo4qmGwSR4lrfxxmMx/KSFmA9CAqYHjxcEJCYHeZg==
X-Gm-Gg: AYBFou3u/LktLwD/sANdJEYC6COKLSnAaroqPF8hSAlmC6ITDSqZ6YamyUsJCcfmWYM
	S4nwIKxWWtwxvk2fGfpr+bIa3plq7rIlR+UVIgnbild0HrWZoXwczbsEJi4xeuCVjLuf82+LH5B
	nU0D5TxMt6BqhymB/zAUZ6XfT+SFJNsp1i/oy2fBukfj0AbFyN6LV1v74tDWSBgqr48XAXhl95f
	peZbWE4EWCLjuzK2cfm6aeB7QCXg7FIplIJvQHEhkuZxRSoTGlAhdNrjoIxAxZVzBWTe6pI0atz
	dAXE/n7DsB8lE0hDxLI+a7enGzLLD8gC1ZIaP2+IQsbtd0DdHZAXekhQXXjyOqBiZXu7l1OpDa0
	K1SYKBmJ6ydfJ8nIXHwyw05MsvCSWQU0AuVATw9gSjY2cafYW+kom1n3WXO0mxRyXCy3eEe3Vfz
	uHkiu/LOYnGXsKPx+HuRt/3FXJOEKEERoHLumXbJz3ZdNPEA2P4w+4+sm/Yppgtu9xrIE2d/759
	qeSCb+e+ZtzJTb35ssgt/uDOyDLcRsC7dzpTd7LF+MVaB+Kndq3yqsltx7T
X-Received: by 2002:a05:600c:8b0a:b0:4a1:6992:f861 with SMTP id 5b1f17b1804b1-4a18e446db6mr326233375e9.1.1792026879579;
        Wed, 14 Oct 2026 18:14:39 -0700 (PDT)
X-Received: from [192.168.1.122] (cpc159313-cmbg20-2-0-cust161.5-4.cable.virginm.net. [82.0.78.162])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1bd99e87csm30060215e9.13.2026.10.14.18.14.38
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Wed, 14 Oct 2026 18:14:39 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-User-Agent: Mozilla Thunderbird
X-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
X-In-Reply-To: <20261014145800.726-1-rand.sec96@gmail.com>