Article View: linux.kernel.netdev
Article #23100Re: [PATCH net v2] ppp: serialize channel operations with unregister
From: Simon Horman
Date: Thu, 26 Nov 2026 14:30
Date: Thu, 26 Nov 2026 14:30
47 lines
10218 bytes
10218 bytes
On Thu, Nov 19, 2026 at 04:43:33PM +0800, Haoli Zhang wrote:
> The channel unregister path disconnects a channel before clearing
> pch->chan. A concurrent PPPIOCCONNECT can observe pch->ppp as NULL while
> pch->chan is still valid and attach the channel again. Unregister can
> then clear pch->chan and release the channel while its clist remains
> linked to a PPP unit.
>
> Serialize PPPIOCCONNECT with unregister using chan_sem. Hold the mutex
> from before disconnecting the channel until it has been removed from the
> channel list and marked dead. An in-flight connect completes before
> unregister disconnects the channel; later connects see the cleared
> channel and fail.
>
> PPPIOCDISCONN must use the same mutex. An in-progress PPPIOCDISCONN can
> clear pch->ppp before it has removed pch->clist and completed
> synchronize_net(). Without the mutex, unregister can see pch->ppp as NULL
> and proceed before that disconnect has finished unlinking the channel and
> waiting for network readers. Taking chan_sem in both paths makes
> unregister wait for the disconnect to finish before clearing pch->chan.
>
> Bridge establishment must also be serialized with unregistering either
> endpoint. Hold both channels' chan_sem mutexes in a stable order while
> establishing the bridge, and reject channels that have been marked dead.
> Unregister holds its channel mutex through unbridging and marking the
> channel dead, so bridge establishment cannot pass the teardown step and
> leave a new bridge reference behind.
>
> The transmit fast path is unchanged. chan_sem drains channel ioctl
> callbacks. ppp_disconnect_channel() removes the channel from the PPP unit
> and waits for network readers before unregister clears pch->chan.
>
> Fixes: 6a196e83a1a7 ("ppp: disconnect channel before nullifying pch->chan")
> Reported-by: syzbot+6b18da3ef22e33061add@syzkaller.appspotmail.com
> Closes: https://syzbot.org/bug?extid=6b18da3ef22e33061add
> Co-developed-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
> Signed-off-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Haoli Zhang <26031212468@stu.xidian.edu.cn>
> ---
> Changes in v2:
> - Serialize PPPIOCDISCONN with channel unregister.
> - Serialize bridge establishment with unregistering either endpoint.
> - Clarify the chan_sem comment and bridge lock ordering.
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261126143038.GB31322@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-372144-linux-kernel-netdev=dewy.ruReferences:
<20261119084333.371234-1-26031212468@stu.xidian.edu.cn>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-372144-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2] ppp: serialize channel operations with unregister Date: Thu, 26 Nov 2026 14:30:38 +0000 Organization: Usenet Network Message-ID: <20261126143038.GB31322@horms.kernel.org> References: <20261119084333.371234-1-26031212468@stu.xidian.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="485091"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:9IU03kPvmHoepQ4b5PZN2y3CYNA= sha256:8uNep/omURd2FEREop9xYjBzKHSuwJ4p6b9Z/TcWUrM= sha1:PWbKaskUAokSVDreB0h2dycphhA= sha256:TZDkA2AJ2Faz1klKPSnSSLQyKqkg+TlJMo3yortjt54= 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 5333E125EE1; Thu, 26 Nov 2026 17:31:09 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 Lnv7LVi_GlyV; Thu, 26 Nov 2026 17:31:05 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-372144-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 97C11125EDC; Thu, 26 Nov 2026 17:30:56 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 44EE22CD38; Thu, 26 Nov 2026 14:30:55 +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=1795703455; b=ZzzbrMKd0grmQI1OhNocy0OViIoBQUiOrwo85g/sogOQDLlhj1ksiNEE5oLt54tDLTRa ZxaT+agKp9tQW1wuhl9NOMwYc8RjxNk3+Z2hJHPdkYWj9QDCpCorscdLbc8lqw0N+DmIX aTz72oIX2qvZb594Qwdbmc+8pnmEwoYhUIZDB/csbrOo12EJF/OSwzjlaGWRnKSBWh6Jl rvmz3kNuHxPQvPtz36RJjs9eZDJvMymGVwHOGA+BHPFzeAdoh3Kbdt/0gHTFa7n8wPinX ZHmX99rTrIOwM0Evur3rb7BCO4HJMqYuVIvnS/1Zdk9uk5y1/9xNBdkkN6LBHr8dAIQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795703455; 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=eRUX/5S9UOo+rDRG4Qm3COyRot6eWYZZm9uVcRV35C4=; b=spNP/gnSZ1aFzFcqTtnQyZneuo6CsKELV/OcJhNQ61BzeNHslGA7vd/rrYNrBk/RMMeg ZsdtFlTL4/1JAhar4eq8E3Rm4zKOAQ+VNUv8MiUfyzO58p9zv9HXYG2bd1M2QH/cmpZ4k nIigN7rLwWjTa9yjlchepb6rjDT9hsI1Tx7qVE/rXMj1HPoOfbQ881VPnp3eu/cTuBm30 itfEVCf6McgRcJ69xQTyhdjRQj5o6WSYN3dcOmZjKuDlECxgY0O3bjfuFoz7y1Cm6J27q iEAd7cMyq9EA/Dz4KSeLPCuj/ZAtrEZO/creQwKefTU6Riz3dxmWuL/mkqe1NOX7RNw== 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=PNrV4sZV; 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 09C8A606A339; Thu, 26 Nov 2026 14:30:55 +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=PNrV4sZV 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=1795703444; b=0jgjEtH3eEU2W1eKLIK1fuLqaWRKqZPN2fZDnf5nhmKEu+DWNiGRq82T0HFmHqHW/PXt LJA7wyowPl/ze9F1TiDXFdzT29OF4QAlwDgaCh/xdCRydw9zAPrE8xCofxWbuUyE5bgSo 7eukCzcuYJ7nHt1nzEtyrbaGw2mwHZ4x6WogbRnhdgIDVA6be6E+3f+5tRlrRoyZ3Y733 TDqnTf9z44tiICixqqEhIckMvWUeTpbbkvWgsVyldM5fB9p2Ywwy9Watp7xuys9IFzrIm /qC/2EgtQpUeua1jGGuyDFfcs0Wwvf3dvzERF/WlGvmrJrriszR1lDpjiPoz52O0n1Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795703444; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=eRUX/5S9UOo+rDRG4Qm3COyRot6eWYZZm9uVcRV35C4=; b=qxuwwtSqGSlLY8kK5G0h2P9m1UMO/2jTSBc97JCBVsKIsw97+rYGp0SsGeSJoZIgVFa4 5sZojw+Py6JygyVgJmIptymhRNn/Mz9ZOnM3v68ffWU7ln0aMHciExSUs0qSzerLKjcZB 6IXLJAnFIJDgn/TmcOuaIxG2+NeaJJdaaAQAPFgvOr2Ks5bxGt8uGsv78DUCKUxnMWpLG n/BmbmS+uWxuZtZ6uri5nYnYIjVlkoBs85E4pM342XbYR2FbfoRJN8/PdPRTNN4r/f19c heflAzGrfnLDVAhVaGkpXRefjh57CqHbyg3GUQ8XmMDadyWGOXNNT48wOZtnGci0W4Q== 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=PNrV4sZV; 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 201F3606A6A1; Thu, 26 Nov 2026 14:30:43 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 285311F000D4; Thu, 26 Nov 2026 14:30:41 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795703443; bh=eRUX/5S9UOo+rDRG4Qm3COyRot6eWYZZm9uVcRV35C4=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=PNrV4sZVaMwPiTWaAPN/jV1TEtbkNWx8sp9FnI97H0TV3XVekfpapC7GpMVueyiXq Dy0kpa+BBXVKWxbesxMsNvJfNyry3kOTqd/AB7W6BL7hygjs+qfnQ2U6ZccWEbEUsD v1Hnt54QynemBHHscnUCj+9iV8egANrb+vTGyUjLCWK9/b9qkW3EahL3rdV4L9NX/Y +J+byAfpQbrN1XX7vy7+6B8W6ofeOAjy61q8QzrZldwrtmfAR1tz0IKUH28THKbHi3 3myyitBB906eFIiUjDez8HSr1SaeoDjs7xOmid5xhmrSmnIxdJCsv6JzU56s4yQFXl PKoBIyyOM6Hsg== X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux-ppp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+6b18da3ef22e33061add@syzkaller.appspotmail.com, 25031212117@stu.xidian.edu.cn, byu@xidian.edu.cn 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: <20261119084333.371234-1-26031212468@stu.xidian.edu.cn>