🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6673

[PATCH net] pppoe: wait for RCU readers before reusing a socket

#6673
From: Qingfang Deng
Date: Fri, 23 Oct 2026 04:37
57 lines
9908 bytes
When pppoe_connect() disconnects or reuses a socket, it removes the old
session from the hash table and resets the socket's fields. An RCU
reader that reached the entry before it was unlinked can still be using
its address, ifindex or next pointer.

If sockets A and B share a hash bucket with A preceding B, a concurrent
__get_item() looking for B can be traversing A when it is removed.
Clearing A->next then makes the lookup miss B and drop the packet.
Reinserting A can similarly redirect the reader into another hash chain.

Call synchronize_net() after unlinking the old session and before
resetting its fields. This allows existing receive-path and
/proc/net/pppoe readers to finish before the socket is cleared or reused.

This was found by Sashiko's static analysis, and reproduced on a VM
stress test with KCSAN.

 BUG: KCSAN: data-race in hash_item+0x1c/0x60

 race at unknown origin, with read to 0xffff888000a1c566 of 2 bytes by task 147 on cpu 2:
  hash_item+0x1c/0x60
  pppoe_seq_next+0x112/0x1b0
  seq_read_iter+0x595/0x700
  seq_read+0xb0/0xe0
  proc_reg_read+0xd0/0xf0
  vfs_read+0xbd/0x220
  ksys_read+0xa9/0x100
  __x64_sys_read+0x47/0x60
  x64_sys_call+0x98/0x1fd0
  do_syscall_64+0x5b/0x260
  entry_SYSCALL_64_after_hwframe+0x4b/0x53

 value changed: 0x0002 -> 0x0000

Fixes: 72cdc67e7fa7 ("pppoe: remove rwlock usage")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020092118.47416-1-qingfang.deng@linux.dev
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
---
 drivers/net/ppp/pppoe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index ee0e318d6a2a..99600fb40c4b 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -622,6 +622,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr_unsized *uservaddr
 			dev_put(po->pppoe_dev);
 			po->pppoe_dev = NULL;
 		}
+		synchronize_net();
 
 		po->pppoe_ifindex = 0;
 		memset(&po->pppoe_pa, 0, sizeof(po->pppoe_pa));
-- 
2.43.0
Technical Details
Message-ID: <20261023043729.219660-1-qingfang.deng@linux.dev>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350902-linux-kernel-netdev=dewy.ru

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-350902-linux-kernel-netdev=dewy.ru
From: qingfang.deng@linux.dev (Qingfang Deng)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] pppoe: wait for RCU readers before reusing a socket
Date: Fri, 23 Oct 2026 12:37:27 +0800
Organization: Usenet Network
Message-ID: <20261023043729.219660-1-qingfang.deng@linux.dev>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="411796"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:v4ycpDCiXn+/ksmPdfPOKu+62t8= sha256:XIKVxbD85Lly+yHuDXurvXzLLaYVO6Td8XLiomKsEqo=
	sha1:kkE1bYTobLQu+rxsJD0zHlsf8h8= sha256:Pk4ouTGoOfELnuZWl7NZ6XbhJ4aAF5AYb0YnANUAIgI=
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 4BB001113DD; Fri, 23 Oct 2026 07:49:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, 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-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
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 0Ra1kiPmYZtG;
	Fri, 23 Oct 2026 07:49:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350902-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 7EDB51113B4; Fri, 23 Oct 2026 07:49:25 +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 DCF3F67825; Fri, 23 Oct 2026 04:37:49 +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=1792730263;
	b=ftzBmhEJPAdSThUsr22gVy5LAWTB6CdqEKFu6S6YAY7piODLWeeqV+BN7VOn6Au0OL+5
	 nwTA8+T8wD7IOfcdFBMcb5JCfE7gG78HwIW9VzWguop9pNs91RX++x1/PVwalfMnl8XaD
	 wdPDr5zgXmiSSYyCKQJB8v0/FqDtRHzL6UfS3j+28We7wYmNzavxssRTcD/vK8yuX6s6Q
	 UpojRVZWi67QaE9R5FnT9kfivnDOjCF6EsGrJPkquvvxRHMdUGStsXM4grnVnMhAGG9lS
	 bKwd5CCp/6B1RWIAJ4IxhhkmRh18Q240Kl2s/T4me/jVhTvkFJ/iPReduGtA45K97tg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792730263;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:
	 Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding;
	bh=f123tdsbUST4XIUSI+zBPuw01Yi2GUfKPUwb5NzT2Rs=;
	b=GEkVg8c8VE5gvI8irxKXhMaRREo5ZwAWFQqxJWLKX5VhjVybS2IQ4wz0CaurmzcvGjx+
	 VP9X54ss8Pnvi0t4gsiGWdAk0+A4MSw+fL9lx6OBaG8xUVnoeTgGapsMzqcOIiduk433N
	 pArmAwIL20eyLMZpBbpYk9feSxCltyx1hQqGexfd6qkfkj5zMZuX5AL3PS12cDzZqzc5/
	 rZpZAxJ/AFPDQUu+oyGyOBwilfIOSnMQ9cxjzkUIIEVHFDQA/fI/nOcD7Bn6F2N0drwN7
	 FDRYd18zOQhRPpnTA4w5Dj+qD/MA3m1KbK2meXMlnhDjAD568sQyo9ClHzpaTLPnJ9g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=smylZh74;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	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 54DF960A2606;
	Fri, 23 Oct 2026 04:37:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=smylZh74
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.199
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792730262;
	b=xft8LvxoBmAlpF0hqFe5UjdH6y10F5Znno1zGmYyHzTau+3wDQnVzWxPHqSE8cgnMX79
	 KjdM5ILOiHYvbNcRYBhTL+1VB3hhFwOcLadADbp+uHPNDebesRN2TJ9+FI98T1b+pnmb2
	 HEyahUdbpsGDyZUd7+VEWxc2bjn6OwT0kUKMqWcsjnYIKp4gn5dHxgmfZkwbrs2LzO1zG
	 gs+l9SD4gUG01rTth3r533+vcemow5X8X8oUr5ei1RpJ1SITO0GN1gHf+ZBVQswRkGM/b
	 +rmXmPaX3cBSmrmpljdhbtaJkFQ2dupdCK3r+rpsWtK4x+2aByKGGqsbPKkfPq/IqeQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792730262;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:MIME-Version:Content-Transfer-Encoding;
	bh=f123tdsbUST4XIUSI+zBPuw01Yi2GUfKPUwb5NzT2Rs=;
	b=OYS+GoRWYk6GIKLEMRF83eEOCfvVTPuCHtY2CkCeFFIF7Yl+zrK5c5LILAxLK3vIHop7
	 vSX9qAMULHPgg/iPE1JMgmCpaGauquRBiovlVrRytmPalLiE1NLRpsGGG08TSW5vYqR87
	 xqZ4m8PpQK0cWPVgmkyCZPqLUYaEL/a/n6FrjSfYyAPgaRmmEKhmrip8IChlCu05I6SNs
	 d+QEErtCrUA6UEpu2XS/mz46wOecWrwAJkbYkpNnTq1Gt/xQ6fokbPZgQGKfinwqlzXIy
	 n7iAIuXslPY2w7N0cMepOBQJRqtSCt8Pqz0SlNcGa3Hg/FnU0tmjgBWVe/QlF1VUpFQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=smylZh74;
	arc=none smtp.remote-ip=91.218.175.199
X-Received: from mta0.migadu.com (out-199.mta0.migadu.com [91.218.175.199])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF2CD606A336
	for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 04:37:40 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AF2CD606A336
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=hI8lFW79eKCI4bBWDUvXpaoorI5+2uT+zu+nDueEt08=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1792730258; v=1; x=1793335058;
 b=smylZh74r6ZvVqUl30ub0GCDSSt78EzeTIXYS4lkwHATPi0k3Tt1sPu4xdKCEgT5a+2KyYa1
 Iskxh7imnbdrOOu22xyULrjtuLMTPX+Mi/PdfoRb8ZTO+BioTN1k72gaXWFpwV8bmLJddfkzcex
 Izo6TrSqCKx5kcIrvRYykA44=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id c621be0b7a2731b2;
	Fri, 23 Oct 2026 04:37:38 +0000
X-Mizu-Trace-ID: c621be0b7a2731b2
X-Migadu-Flow: FLOW_OUT
X-Cc: Sashiko <sashiko-bot@kernel.org>
X-Mailer: git-send-email 2.43.0
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