Article View: linux.kernel.netdev
Article #7500Re: [PATCH] netfilter: xt_policy: add NULL check for skb_dst() in output policy match
From: Florian Westphal
Date: Mon, 26 Oct 2026 13:14
Date: Mon, 26 Oct 2026 13:14
18 lines
7601 bytes
7601 bytes
Fang Xieyan <fangxy@xiaopeng.com> wrote:
> match_policy_out() accesses dst->xfrm without checking whether
> skb_dst() returned NULL. If no dst entry is attached to the skb,
> this dereference is invalid.
If there is no dst we'd have crashed already:
return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT,
net, sk, skb, NULL, skb_dst_dev(skb),
dst_output);
likewise, okter in ip stack:
if (lwtunnel_xmit_redirect(dst->lwtstate)) {
there are several other places that don't do NULL checks here.
So either all of those need them or none at all.
Technical Details
Message-ID:
<at9SGAuHjV3OjFKZ@strlen.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351912-linux-kernel-netdev=dewy.ruReferences:
<20261026125313.14810-1-fangxy@xiaopeng.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-351912-linux-kernel-netdev=dewy.ru From: fw@strlen.de (Florian Westphal) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] netfilter: xt_policy: add NULL check for skb_dst() in output policy match Date: Mon, 26 Oct 2026 14:14:00 +0100 Organization: Usenet Network Message-ID: <at9SGAuHjV3OjFKZ@strlen.de> References: <20261026125313.14810-1-fangxy@xiaopeng.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1313178"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:6dYMtXxGFJTG5AJS5WjC7jHDx3o= sha256:pRFCcubdfdlnRSqBmcYl2+ySFziEtrkamdpIJVJDi/s= sha1:wyqz0omwe0OnYSfSYXNov0S5cpI= sha256:+n0dlBG8fjJjaHBRdgtwzmg/WDvOWhH0c9/qK4u7FE0= Content-Disposition: inline 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 E9B35125BA6; Mon, 26 Oct 2026 16:21:04 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.95 X-Spam-Status: No, score=-2.95 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no 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 oWD1ybLsoowz; Mon, 26 Oct 2026 16:21:01 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351912-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=strlen.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id EA287125BA4; Mon, 26 Oct 2026 16:20:57 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id E237A35820; Mon, 26 Oct 2026 13:14:51 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793020491; b=HaO72AjqwJuL2WWjYaX7zJXPc0hfBlGBnp1rCGjFU/QH62hyZsRHU3fx4Gn3Hxg+Qde8 Ru6dWzEm7cGCg3d75u8OymEHmUWfAL3OwL5hW8Q3KZADFwWsotvah+gP4SLJX9gYBVXZB 8j1Moagq+q+7j+sJ1qK/+KYhgxMEhPOjpALGAKJZ5Fx9WKOGP/ewi/A6OlPyo3/oCzlbJ yWjKdJB8cLyy5G9eT8kJQuzaKwInE8IXRN81V+aEvJ1QLMdTELowkLxAJ3ODnZbI9dag4 /yIyY7klIlXkPUOsQ//iquHsq6mSFv9fLH36DOSF/SJvntap7MpdqT9iq6iswtHxfKw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793020491; h=X-Original-To:Received:DMARC-Filter:Received:Date:From:To:Cc:Subject: Message-ID:References:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=AwWJ4z5We8tw8FtwnrIHYZkIJ87KPPmSVapZy9yZJ28=; b=WJz4A7+waYKgrUfdWAdcGs15m6daQ0NHN3sqpR7FtNPLdCbsXTQkhHxNyL2GooQ4VRcV WXS7kpaa6VZKSj8Bw9CsJCn81OTEEMWG6heyNHLzunheuxTul6N2M5jsMWXursB4hpJ+q 8/aQ9WGMDkjqVY8pXtSHXZrkF+R0RKEnB1pkxMo7icA6551Rm3cZzaZp678TEU9p4Wl7I mzxj7LrAGNYpqHgXCwu8IOg437iQ73fO34JGb3Bzi2CnEkFI9bmIMEWeZXwFQ9VYKyXLx aFWETBgfumWqxB/YPq+ye6ihMGkSCG6esAWQrfegcMITtr3UVHn8jMgCmK+80g/KeEA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDB99606A322; Mon, 26 Oct 2026 13:14:51 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.216.245.30 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793020486; b=tuPvbfXFHUPVAhDjbJgvD8OXn2LiedWM5VObIdL4WHHkumslPZ6PGlddedunHQEY2biP CPqyxBlCsZvrIt1GfrOrq8Cu9ov98pbxW5dN0OeaOMpbN8ApjcTmRmuQVvp8U18S5bZzV GfNQ7FeplM+44s+dvpG5+SlWLUQFtaisgq+qMQY9Tk9d0MyEOkecCEeANu4LmI+NhEbty tGcP+H2TvpW6GjRynfFh9BSddSBhk3he897Ec3tE84tSAw37rszoxuJ44P+yPoWX6K/Au Zu5B4yiGbf0d/JmLPrTlO7c/cPul7OH6MnE5H+/7bVbU4h4I/LSAHepieMeLOtn6+0w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793020486; h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=AwWJ4z5We8tw8FtwnrIHYZkIJ87KPPmSVapZy9yZJ28=; b=z3okPEOM32i7i/0LSdpa5a46gGpJBXSw95lYA4rYeWwTW/6544ApFqu6K4urUx4BxZDa k1P8ojadwPMkWpxQJcFm4CE6JOZulc++6SEBahL8U5TrgJslghL+TEvYFEfcW3R1TwU0e BJ9mAbzi6+IIlnykUjyEU1zUf89KNU5hMYeQM1D+HW+CIgaiCkSuuaS1fVLYlWbY5zM00 Y26UG2J/VgwlTb3ETW0CRzvuIeC3amsYieU4r5vgXLkcBPOTaeJ6fy1oydBAZ8akSilEd uhvMztN5UQQT+28dp2u76P03PR1xWpQpz3Ocp8ougjYViXSsw6Dj+Xo1Y3zSXqXv2RQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=none smtp.remote-ip=91.216.245.30 X-Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98925606A327; Mon, 26 Oct 2026 13:14:44 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 98925606A327 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de X-Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003) id D9A83603A1; Mon, 26 Oct 2026 14:14:35 +0100 (CET) X-Cc: pablo@netfilter.org, phil@nwl.cc, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Weibin Liu <liuwb@xiaopeng.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261026125313.14810-1-fangxy@xiaopeng.com>