🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26707

[PATCH net] net: qrtr: ns: reject BYE from local sockets

#26707
From: Murali Krishna
Date: Fri, 04 Dec 2026 03:47
70 lines
13886 bytes
ctrl_cmd_bye() acts on whichever node sent the BYE. Any local socket,
including an unprivileged one, can send to the name server's control
port, and a local sender's node is the local node. Such a BYE makes the
name server delete every server registered on the local node, announce
DEL_SERVER for each to the other nodes and to local lookups, and free
the local node's record. The services stay unlisted until they register
again.

The other handlers already stop a local sender from acting for anyone
but itself: a local NEW_SERVER or DEL_SERVER applies to the sender's
own port, a local DEL_CLIENT must come from the port being closed, and
DEL_LOOKUP removes only the sender's lookups. A genuine BYE is always
for a remote node: qrtr_endpoint_unregister() sends one for each node
an endpoint carried, and a remote node can send its own. Reject a BYE
from the local node.

Hui Peng reported this with a patch that required a BYE to come from
the control port [1]. As its review noted, a remote BYE can carry the
legacy control port 0xffff as its source, since qrtr_endpoint_post()
maps the legacy value only for the destination port, so that check
could also drop genuine BYEs. Checking for a local sender, as the
review suggested, leaves remote BYEs alone.

It was found again by an AI coding assistant while working on an IPA
fix that involves the same BYE path, and reproduced as an unprivileged
user on a distribution 7.0 kernel: after one socket sends a
QRTR_TYPE_BYE control packet to the local control port, the name server
no longer lists a service registered by another socket, and a lookup
client gets DEL_SERVER for it, while a PING sent the same way changes
nothing. The fix itself is build-tested only (arm64, W=1). The fix and
this message were drafted with an LLM coding assistant and reviewed by
me.

Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace")
Reported-by: Hui Peng <benquike@gmail.com>
Closes: https://lore.kernel.org/20260919212850.3240353-1-benquike@gmail.com [1]
Cc: stable@vger.kernel.org
Signed-off-by: Murali Krishna <muralikrishna2444b@gmail.com>
---
Hui, your patch for this has been at changes-requested since September,
so I picked it up and kept you as Reported-by. This version only rejects
a BYE from a local sender, as the review of your patch suggested, and
leaves its short-packet part alone.

I have a small unprivileged test program that shows the problem and can
send it to the maintainers if it helps.

 net/qrtr/ns.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 8209573221a5..ab75992224e0 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -347,6 +347,10 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from)
 	iv.iov_base = &pkt;
 	iv.iov_len = sizeof(pkt);
 
+	/* Only a remote node goes away; a local socket can't say BYE for one */
+	if (from->sq_node == qrtr_ns.local_node)
+		return -EINVAL;
+
 	node = node_get(from->sq_node);
 	if (!node)
 		return 0;

base-commit: c1c39137dcc3134010566ff29a81c93124efa539
-- 
2.43.0
Technical Details
Message-ID: <20261204034736.44740-1-muralikrishna2444b@gmail.com>
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ro.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377025-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ro.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377025-linux-kernel-netdev=dewy.ru
From: muralikrishna2444b@gmail.com (Murali Krishna)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] net: qrtr: ns: reject BYE from local sockets
Date: Fri,  4 Dec 2026 09:17:27 +0530
Organization: Usenet Network
Message-ID: <20261204034736.44740-1-muralikrishna2444b@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2667809"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:mwZrD1WDAtZcZA2DTKGIN1LOLjg= sha256:iJD4DU2CqWn9+L02rY1P2VUezQd+qDxgPT+a3icDfM8=
	sha1:GZ87s9pfcJgfaMfAmRz8h9OC2j4= sha256:cIJq6wIrkElgL9cTtx1WemdPRlg9zY1UHZ1kTn/1ZFM=
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 BED74117AE0; Fri,  4 Dec 2026 06:48:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.297
X-Spam-Status: No, score=-3.297 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.001,
	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=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 ZK10IiU2JDqq;
	Fri,  4 Dec 2026 06:48:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377025-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A7ABC117AB8; Fri,  4 Dec 2026 06:48:43 +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 429FB267AC; Fri,  4 Dec 2026 03:48:42 +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=1796356122;
	b=2P4zj4tegCsB/oSXvuIuGeZTpFk6R6nkWtgVxJKGFGcktlZjF+nFppX0L90/NZVe4qmu
	 hKDMWWIjgt7ezNeHUorU9kA4/06zSgx7b3DE3bz9bSsUc/jdSLx3wbXGKZWdKR1pUsDGW
	 oY7RtMFSVZnt1/WFPpd2bPH3SD/yByR9Q9Q3yvTGi8512kF1WDpU47nKeNkhqtsVghgIo
	 tDm2uPuOOIJmn+H2n+pS71+fwEBIuxgN0BVu9hTDf8C5zAKUi6gFoVbBzq2Dr9J5ti//X
	 e6eR84kkLehEKjljupq1B0bNFBLS3NR+DVKCFYIqL3aT+Qo8HNwsGuGR489QuKohGMw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796356122;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received: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=pEF5h6D+ouUN6wQG0Hh037mjxSbZDvRCTM+QBx0UvCs=;
	b=W7weCX4WnTv4GUkkDR/QtA1BYJUkas6JxN2TupC0LbkT5Zd5XUr0BYXIirrBcTUs9pA+
	 8WpmxHxNdQ9tjFfArHS6g1xKjGncdIhamusiP/qxTMj8LcZUjyAyuufoekhSRTO52ClDg
	 14SHSQbWX+3JItOPnoC5o6b1iz7N3Rt0WD0ORArbgMupM1hTujgcjfrQYPL34QQkWJQiy
	 2GwP9limMotXcEDh8fkMU1qDhIRmY/VUgWPmiqDL3zNGml7B++NbEhqCYVi2gJEDWOsKx
	 ezW70TD8PtR2NCGEkasSRZiAou+fm/ssAEAyMWUJb6tVPmCpYERLqrx607wrhknozww==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=O6FNS8cT;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 1A5C1606A32F;
	Fri,  4 Dec 2026 03:48:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=O6FNS8cT
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.5
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796356121;
	b=hoURGQWVzzUZKrF5VQ9OgbPkj/o6HblJ4IJTgJIy0VQHYRtgGk4XJjuUu+gOxf72dTeQ
	 VYZ7kfuDhNHpmcJLrs3mPt4/muCoR/N1ivkwTIMd7zSbnBcwWLkXYs7fFyhpRhQDt5TBs
	 v4zGgtpUXv5VEK9iZaHAZbr3bwqgKu00qmSKPeo1SGVHVsR5+WUFnwVed/Unw9H2iWdC4
	 a/SU7lW6u5VQTuWpbqoGDPKI/n8tcUiZiT716ZBtlKHFfW8yiVitj+AEH14IiCzSZ/cvW
	 Ca3O3E5KxaqCwF3gbmmHQVyhAAaNnGRR0YqzLJY+ImKWexn9nVcxDxda5BKKcjzfDbg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796356121;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=pEF5h6D+ouUN6wQG0Hh037mjxSbZDvRCTM+QBx0UvCs=;
	b=eNbKYs+Q5Fgo3zzo+3Uy1o1gCQE11txDr9vrwyVLpEsg5NGj8CFEmLDI5W9Ro45Pl1bw
	 KSy3T9bY41kcvASoGZGavUAE5sOkqZPqMiGGhHW1k1d/8mydgDqg2p11shduPYXRdAyPs
	 r5kRC+2bkjz7HRYGW0GJvN0XcVNV1celhsfG2BaQjhuc8K5VCB3bP39Q12Ff7f1nvGJ1F
	 P8j+F8b5NJzLXNk7uWbHSfx6CGDJ1D7RGCgFlqZDeQZ8Dvu7fC1k8ZiftXXkKagiLdg1P
	 uPEjC2U5r7de20zlicQjsXzhTohl7CvcVFLZK2kQvnjA49/v5FQbOQL8fA0VgNs9OxQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=O6FNS8cT;
	arc=none smtp.remote-ip=74.125.229.5
X-Received: from mail-dy2-f5.google.com (mail-dy2-f5.google.com [74.125.229.5])
	(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 4E2AA606A32C
	for <netdev@vger.kernel.org>; Fri,  4 Dec 2026 03:48:40 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4E2AA606A32C
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-dy2-f5.google.com with SMTP id 5a478bee46e88-38748027e51so503208eec.0
        for <netdev@vger.kernel.org>; Thu, 03 Dec 2026 19:48:40 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796356119; x=1796960919; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=pEF5h6D+ouUN6wQG0Hh037mjxSbZDvRCTM+QBx0UvCs=;
        b=O6FNS8cTwxh+cCALFy84+D+7H9auC4R9tLYUwZqbeiuiNL7wJ6xQhrNQmAZQjK3VxU
         jb7wUJJDl7BO5yOb5u9QQQJ0Ba0Mr7yxHadI/2a6sJQZeT+UgvmrXYhcIG7DbTgdGfHS
         2Qt3R7I8mtTtvd5tLduNcepJ+UnrhaT7AVf+juVCB/vj5TxTrzZw/OSbDCDt0KW7zj8w
         i4BvcHXganhTIkYgRJRqHKM2nfJWWV6dtwqPTEXmkHNi7NfSZ+6oOdGV+ZekJf+h5/6d
         VnyN2pv8m+NzQOHbeUl0KwOFE85O2ZmHRcAGXzheaTlIFCFAbEfTMZY+qG+nB52+yriS
         cBQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796356119; x=1796960919;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=pEF5h6D+ouUN6wQG0Hh037mjxSbZDvRCTM+QBx0UvCs=;
        b=mJvT5SFhy6BoZUmHEAIdxMRzwNtF/Olq+qKRdgZvul5nuC4lL17dLA7UP1vchRx8kB
         vVc0wSHgi9JZS5o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GYeuUY/ioFmDMtosW7Yk/BJnCWwLfGG8KwruLefH/uQmu5jhK6d2xvS8zF9T+
	AI0Fdk3gdrm/dNYMWwvtDVy8
X-Received: by 2002:a05:7022:ea8d:b0:1b5:b312:1a59 with SMTP id a92af1059eb24-1b5d7102095mr913126c88.30.1796356119320;
        Thu, 03 Dec 2026 19:48:39 -0800 (PST)
X-Received: from localhost ([2a09:bac5:3fa8:16b4::243:63])
        by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5d642de41sm2862893c88.3.2026.12.03.19.48.34
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 03 Dec 2026 19:48:38 -0800 (PST)
X-Cc: Murali Krishna <muralikrishna2444b@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	Hui Peng <benquike@gmail.com>,
	linux-arm-msm@vger.kernel.org,
	netdev@vger.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