From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D7F5169AD2; Tue, 16 Jun 2026 17:48:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781632130; cv=none; b=Gq3ShYWyIGjxQzcLy+h3TDevAT2XBD5OvTppE2YXLNdMwt1mYToMw+2a4UPIKhDfmetuukpxsDop/23c0XqiR9IBKay9sKjSRtdNU/8wGws24kINin7seiMZgyS8qOQ4mzW2kYqawawWVqvmKwSyhlOKebU5rSYL0eqT3Mz816U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781632130; c=relaxed/simple; bh=6+RW/tjJ2Q4PCJHiJydTTH+W5YpVmqOLyPfHU4kB6yo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PCF4x8OiIolNjOz33gpR2gzMVx1vFOKXXgIy1qe1H8pAeg4oUawAJ2yZqT3AYvMTDy4WRhkWo94JTY4yZFwNH8HXsn52T+dSpGBuXI6+lrOalWObK028SNN+ngyqiUyT6xdpQjHQEK6ZPiZlUiOrUffhElzkHtbaOfmADf7suRc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GWRknijC; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GWRknijC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9D061F000E9; Tue, 16 Jun 2026 17:48:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781632128; bh=Xu+T77irdz0xcl5dEaGmHkUB+bijGCy0JJ878ikSm7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GWRknijC4epjMr3fwx022nSC5OgwycLFEMnFlGpIniAN8xA9PpNAizXSolFv1Nsc4 A38GNs2eCzaeewULXWeBWrKH9/dIm8So2CRvejkD7Pdn50xaHusPZ/lW2YqmDwWiI2 D7UaykVnJRKRYsdxNsVMSh3jroM/nr19OsgZOLg8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Manivannan Sadhasivam , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 353/522] net: qrtr: ns: Limit the total number of nodes Date: Tue, 16 Jun 2026 20:28:20 +0530 Message-ID: <20260616145142.310613761@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145125.307082728@linuxfoundation.org> References: <20260616145125.307082728@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Manivannan Sadhasivam [ Upstream commit 27d5e84e810b0849d08b9aec68e48570461ce313 ] Currently, the nameserver doesn't limit the number of nodes it handles. This can be an attack vector if a malicious client starts registering random nodes, leading to memory exhaustion. Hence, limit the maximum number of nodes to 64. Note that, limit of 64 is chosen based on the current platform requirements. If requirement changes in the future, this limit can be increased. Cc: stable@vger.kernel.org Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace") Signed-off-by: Manivannan Sadhasivam Link: https://patch.msgid.link/20260409-qrtr-fix-v3-4-00a8a5ff2b51@oss.qualcomm.com Signed-off-by: Jakub Kicinski [ dropped node_count-- hunk since ctrl_cmd_bye() has no delete_node ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/qrtr/ns.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/net/qrtr/ns.c +++ b/net/qrtr/ns.c @@ -75,6 +75,16 @@ struct qrtr_node { */ #define QRTR_NS_MAX_LOOKUPS 64 +/* Max nodes, server, lookup limits are chosen based on the current platform + * requirements. If the requirement changes in the future, these values can be + * increased. + */ +#define QRTR_NS_MAX_NODES 64 +#define QRTR_NS_MAX_SERVERS 256 +#define QRTR_NS_MAX_LOOKUPS 64 + +static u8 node_count; + static struct qrtr_node *node_get(unsigned int node_id) { struct qrtr_node *node; @@ -83,6 +93,11 @@ static struct qrtr_node *node_get(unsign if (node) return node; + if (node_count >= QRTR_NS_MAX_NODES) { + pr_err_ratelimited("QRTR clients exceed max node limit!\n"); + return NULL; + } + /* If node didn't exist, allocate and insert it to the tree */ node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) @@ -96,6 +111,8 @@ static struct qrtr_node *node_get(unsign return NULL; } + node_count++; + return node; }