Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.5 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796356120; b=xf5lhJOQ0mImSuxBt+j+AJama5H+wwCphuvivM55IYWG2A9f/spCCtNr9sp+euZXpiE4 s71GddsPdCIQKc65oG//vveCoyH7ldt2zZyCHkDMW9s8sZ1PJlZHLTC+dFUKuStV0lQqQ d5l0tcuNogYXwKX3Oali3iPuW8hlBotlGcRXpdyOlnpJNXVW+zuddi67fuLsEvfFj5yyV 582xF3KNVjx7khPXavfnsgPhvBe2rCHclOhBQ0lfxTiz/xovxzYeKeCjGFi27OKGn5yn/ VhzkuuaP/yK8ltYZrdvvB+0T83FbTsYKvj6dEjk1Q654BnyZO2E5bGLcIgSub/lmf+A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796356120; 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=AtgtID8exGAU1epi7BwtDKnSn2p2xusZVnb9UC22AMx4dsKTbXLbbCd8NC86Dx222fuz BALitViRGx/sNwt9B89LIA0hYhZVniwTAXTKFVTlkBgdxB1FxbirD37EDIpj3evfs7Em4 pKdtZcGk1beGjQ5OmrcBTWsXm2xPt2iwT6JysDdeLbKXjHyq5XnFpj0NmUArGj7wsOiMO c4o8qad7pINvAg8StVsX1rEkool8ZBAf6MzFMkMjwxbQRgyVVrAJy5sKapouBXsz4Rne9 +dRCQ2Pc6k/LhV9HyqYn9+/L2Rx2LqaqXTW/wvrdGZiFByOZHWq4/PIOa3mZzcTvSzg== 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 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 4E22B606A322 for ; Fri, 4 Dec 2026 03:48:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4E22B606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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 Received: by mail-dy2-f5.google.com with SMTP id 5a478bee46e88-38748027e51so503206eec.0 for ; Thu, 03 Dec 2026 19:48:40 -0800 (PST) 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=kOf1tcKS7XXaakx2i6NtjAKTZzwZTEqPdMYi+kG7ftJI8sUwHZONxWVyRoIHSVqFND 8RDDN/4rAsRcaSl9ZCgM3MdidG8PrIZ3hUIVaVvCpUu2HG0Z6f981bdsCTSXFbYR3BfA Hq6ZAkbQKO8hOC3RAk6fdRdlSzXZ7Lz44OOBm6KL4XJnPOYLwOtXjVkw1khOx6GMlewh NCUNAiKQp/zXtRRfj1hZsTi/tLl4YPkdS7Q6+NhTJnMWHl5QgdT3SoPTWqP1x2/6AA4m hh9CtmWMZEtYV+YoWtL8U/GUYXpYrALYpx0tftaMW1Gf6yuM6QeCgq+XbTTtKtlfBnMt mtsg== X-Forwarded-Encrypted: i=1; AL+hErF2K72ErjFJQPc3Ma1cXwgBN/AgaOPvkIJli9HIOi4iZTlOkNwsVKihSwVa3PB1AIMYMsR4WGmkjnduNbJT@vger.kernel.org X-Gm-Message-State: APuU4Z8xwTGWqz8075zKHNwLgQJI+3Y/ruUakFl2gQkOVZP71WPia4uv vhkdOqKUsbExWcU4W5dPfsMaPMJ6wiVht80GYXBULq7m1DktPO6xp8oUVHeMuro= X-Gm-Gg: AZFdTZejEMOqPVhgxNRyHoKb8LQADR6QhJRKCilw1OKWdwV8cpyHHkFeRrtg7tDi59H 29ve67wuktaju5hYBpEtZaGuLcx+2k5CQDy/MPxD/wYAj68G/b2CcJPblxcq0+k8E1akcMukEQu rpCAdQwQrMhkgesFnaYRYEG64iIuVhWRLX4xb5LdT+sviFHG7uaJmDfIeFGvH9R6NYvcg14kYZG BbkH3TY8TinL4pjUPXii4h0c05Yns2+A1CCXlExU+S41nlG0mdgKzSmUT73qSJhbCicypASNTcZ Mc3MeyojfE5kGnpsGWS1gf6VCHMWidOqLRSLU1QKQCx1ZZ0aEbVWZH6sDmzT7/Ymf+eQSFk1on9 YjSF5ANx4yptX4yQk5E96bhcEBlEZOW3hvrRhBiy3BOV7FVGzb2wvm1/cwdWn351l3PeS0KEObI RbZBazood9LLNv7IsHl/fYAYgPagnMNBTaAYeyjQYv21L6qJapKv7kOQZlll2CSfQ6pPuaztMDI bnMamQ8y/C2QrTyOKKQlMhB0HtKKDSDp1fQ4WJLm2LS24yHDceNF6No3ZzaxSrWkwxVcelvan2k K+jJRLZh8rffKh1jH/BE/toF 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) 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) From: Murali Krishna To: Manivannan Sadhasivam Cc: Murali Krishna , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Hui Peng , linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net] net: qrtr: ns: reject BYE from local sockets Date: Fri, 4 Dec 2026 09:17:27 +0530 Message-ID: <20261204034736.44740-1-muralikrishna2444b@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Closes: https://lore.kernel.org/20260919212850.3240353-1-benquike@gmail.com [1] Cc: stable@vger.kernel.org Signed-off-by: Murali Krishna --- 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