Article View: linux.kernel.netdev
Article #23892Re: [PATCH net] pfcp: drop packets until the device is initialised
From: Simon Horman
Date: Sat, 28 Nov 2026 14:15
Date: Sat, 28 Nov 2026 14:15
43 lines
9447 bytes
9447 bytes
On Thu, Nov 19, 2026 at 01:29:46PM +0100, Andrey Misiurov wrote:
> pfcp_newlink() creates the PFCP UDP socket (port 8805) and publishes it
> (sk_user_data = pfcp, encap_rcv = pfcp_encap_recv) before
> register_netdevice() runs ndo_init, which is where pfcp->dev is set. A
> datagram that arrives in that window passes the "pfcp != NULL" check in
> pfcp_encap_recv() and then dereferences a NULL pfcp->dev:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000108
> #PF: supervisor read access in kernel mode
> Oops: 0000 [#1] SMP PTI
> CPU: 0 PID: 26516 Comm: pfcp_race
> RIP: 0010:pfcp_encap_recv+0xeb/0x1d0 [pfcp]
> Call Trace:
> <IRQ>
> udp_queue_rcv_one_skb+0x24a/0x560
> udp_queue_rcv_skb+0x4f/0x80
> udp_unicast_rcv_skb+0x78/0xa0
> __udp4_lib_rcv+0x519/0x5f0
> udp_rcv+0x25/0x40
> ip_protocol_deliver_rcu+0xd4/0x210
> ip_local_deliver_finish+0x86/0x110
> ip_local_deliver+0x65/0x110
> ip_rcv+0x17d/0x190
> __netif_receive_skb_one_core+0x8d/0xa0
>
> The window is wide when register_netdevice() fails before ndo_init (e.g. an
> invalid name): the socket stays live until pfcp_del_sock() on the error
> path. A narrower window also exists on the normal success path.
>
> Drop the packet while pfcp->dev is not yet set or the device is not
> running.
>
> Fixes: 76c8764ef36a ("pfcp: add PFCP module")
> Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
> ---
> Found during a backport review.
>
> Reproduced on ubuntu-resolute 7.0.0-42: flood UDP :8805 while creating a
> pfcp link with an invalid name (register_netdevice() fails before ndo_init)
> -> the NULL-deref above (kdump vmcore). With the fix the same run stays clean.
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261128141557.GF31322@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373156-linux-kernel-netdev=dewy.ruReferences:
<20261119122946.1720693-1-amisiurov@cloudlinux.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373156-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] pfcp: drop packets until the device is initialised Date: Sat, 28 Nov 2026 14:15:57 +0000 Organization: Usenet Network Message-ID: <20261128141557.GF31322@horms.kernel.org> References: <20261119122946.1720693-1-amisiurov@cloudlinux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="963757"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:oJlJM1w7qJI4C6Xjy8cdiISTtTc= sha256:PLN5/cMRnrQeUjPa4mehUzRmLgqQDyr4iIiCWz9l6LM= sha1:mWHdbxahTeU1bT608qmZ9Wq/8oQ= sha256:zvFCnFmUO3ccoEYXKAo0ADRcpuYo5ZViHGJQPu2CdkY= 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 A91B2125F7D; Sat, 28 Nov 2026 17:16:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 HPXlZ1SkjW9O; Sat, 28 Nov 2026 17:16:18 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373156-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 9442E125F79; Sat, 28 Nov 2026 17:16:10 +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 74C4D2B0B3; Sat, 28 Nov 2026 14:16:08 +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=1795875368; b=yEKigx6618yDSNj8GY7xbr0p+k4RQ/MMmEQzdWQ04baNH8DejMuHefvZ2G006NHVdRMD cm3XM6JrTj/dUSqTsp9/w1ym5XYbc83idMnE9JXQOFpp6FY2b22KRtKx3q4PlqLbp9pqQ dUmmqcGQx1lsT2NIfycKXisRXug4MGm/G4PW3FCW+m2hHGz4SXfRzJEDLNjzkq3gDw0G3 0aAIRtLUmFciqtPl37X3BSMLkco5qE9mM39iUM0r/ABfCkcFwtVSQiWwNzBhMYtmRx5a2 xtwGpbZtpnZj9MFb8hMt5gev6MJCrAUCLlR9F+ZFpUxDr69wXcQG1heZU81z/PZbevg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795875368; h=X-Original-To:Received:Received:DKIM-Signature: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=vSv3enixPy0AIUfzIXPL5JzF2Q4UKi/kDSZtNO9+xEE=; b=fmBr9S3YtMzMCZfZ4tsTLjEUYoN8o3Huk3/4N8mcOwRz0eA49gh7o8HfbkVD/YZsd0zX uDm/JsG6xf5JHOZBaqzYymNk6rBugO6CZJmYFfVgcqHRYgUHbU+2puTaPLNxU9JJYKkEH T4teerHBt2r71JjrMlP6Va0WI4w/59LCFURSN5O3lSLGibDo0ob2zElGwPwz/eQEcjPrT bGGP6ry3JszNhZIj1l5QWtK2gAj0vh6tBfaK1xO/lMqnbiskgOSE13+qnhuvzoBwtA7u8 yS7YnGE7EhSXtlL3Mj72B0Hj6gG0z+iKh+hrR/lsZndscQ/XYFovmVMdzDTTciYOg1w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OtqJZ9+H; 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 EADF2606A32E; Sat, 28 Nov 2026 14:16:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OtqJZ9+H X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795875362; b=SHfQoW3KMbqSyJIguqFWsk+GaHYXSgY49IqCpFLyz2RA+cMYGAyqQjHb126U435kB9vW CyzpugWQnJmyGT8daihlcWHyLWsmm6cokDCetFlxdlzyfTGZLztOhRdrN5GCq7oKX2aN8 aM9C7owDfbLFF+W1OVkLTgjzZHvHkBXHj/GcpxPvnCnLG47lz7ONoBgCO0w91YcIZ3HwW CtYMYa48tknVynKA15yJhhekLn1QNxx1S++8O4GRo3Qn1ctL8gCYdK+/SQB8ixjVID8GR 2WSPtXGRKhG3moJvNPWzYvxgHY9PXZM5Z6OVW+0GMtko0Ucn5riGtFPwvCRViGcJL7Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795875362; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=vSv3enixPy0AIUfzIXPL5JzF2Q4UKi/kDSZtNO9+xEE=; b=2w3TrYm5U3/5n0T2tpjTWLyQutC20GEIjuvvub0Paj1yK01dkKIpZLN+UhW3ya9wCior uFoyI0zV0lKpSET4FyL288WIBbSYEEECpD801qcUmW8xk6JiKXDAb7qb7Ha4ZUwTN3dII Li3rjpaKE25oHUntvVOk457hX6f29/GaV148QzjnzGTXYvQBJ9NJupuf1W6irkfwBjoC8 YQ6vWfmPHrLEKsB5tIDxlCoP17KuW34QpqbC/DHUhpAbU2HAuJ5RbzfVloCIi9H+/gBdH SZXrEjn9cJscOg6SQOxgt7GAwtYeMJAbV8qP25QY/UkvD+1s3IxzkxhzqeB8nB1jkyA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OtqJZ9+H; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14985606A31C; Sat, 28 Nov 2026 14:16:01 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F21A11F000C1; Sat, 28 Nov 2026 14:15:59 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795875361; bh=vSv3enixPy0AIUfzIXPL5JzF2Q4UKi/kDSZtNO9+xEE=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=OtqJZ9+HHNxq2eYDXC+rslajrfsAgyvbR4fyxKdl2Zs26qqAVTJSMeQ5BYmK8HnFu 6UuUwDok3npDP/rf/gaLPKpt20f3aSnop2RhRmvVWclMmKnQ/NVwoQFxywCFsi2DQP scGnxcVmuwWKER6n+ylMbTZUrsAoE8D7RwVvMwAPYrUXSe9Q0s+LYTzQeRwZRuuOH8 F0T0enuvqj4xSzU4zrFJOvWku/LKJuqtQnI9NUD8Z0wc8DXXI7T9yWKbbAwAWYUKHY qWWs4ch1Bd0efxTTXHpMadnE8xoC3M2leck7Kei8QKqgQ3J1Dtm5v0/A6VQJUMcJPs EGCRBwIBi74zQ== X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Wojciech Drewek <wojciech.drewek@intel.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org 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: <20261119122946.1720693-1-amisiurov@cloudlinux.com>