From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4C28224DCF9 for ; Fri, 1 May 2026 12:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777637404; cv=none; b=iZFPE2ibCkPAHjIaEKTsOh12rw3DZ4rqQvXvyjCLlBx5lJogYMBc0ddPYhHEL2zVgrVxafTnibegyAsYVIkwK3hIigjJlMINFnUqS5DFmm/sPtG+7r1gSJkY/kTQ4PyN7crV5mrYqCicILKsPQMc1d5F7XXOtjchVhhxYDUbyqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777637404; c=relaxed/simple; bh=MuBVBLuJL0YTZoOUTO2VHaHDT7Fvy7Asf+UyDa/vSag=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=elVmwTxnvqdLMLBSkSz/+dkXTUuzYEH+uHhrIja3lQKlJAbA15nTNxv9R25FHGetiKBDbS63ZyVejvtVj7101S4FbQ+vGc9HepcT4F2AakHjnPgxd65KtBkXBBpXoOwgsTY1mhLJyKi2EXMtClvOoqTfZdHG1tjBa8QHkJ3TKQU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tUoKIbLm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tUoKIbLm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA4EAC2BCB4; Fri, 1 May 2026 12:10:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777637404; bh=MuBVBLuJL0YTZoOUTO2VHaHDT7Fvy7Asf+UyDa/vSag=; h=Subject:To:Cc:From:Date:From; b=tUoKIbLmkcyo5XJNWkDawOgDbaqqSoWzteLJH5LQbdDS9OyHE8Tah1lN9hTJWwIO0 q4ceD2ab565/uaxD4HsW9RrNjAjfEjHEOAywMS593O4etMHFY4YDz/sIj8uZ9uqSa6 21OcQ0dpqum1HQdqoj9uEpaxgI1jb5CkhH4y2T9c= Subject: FAILED: patch "[PATCH] net: qrtr: ns: Limit the total number of nodes" failed to apply to 6.1-stable tree To: manivannan.sadhasivam@oss.qualcomm.com,kuba@kernel.org Cc: From: Date: Fri, 01 May 2026 14:09:53 +0200 Message-ID: <2026050153-cash-flakily-0066@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 27d5e84e810b0849d08b9aec68e48570461ce313 # git commit -s git send-email --to '' --in-reply-to '2026050153-cash-flakily-0066@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 27d5e84e810b0849d08b9aec68e48570461ce313 Mon Sep 17 00:00:00 2001 From: Manivannan Sadhasivam Date: Thu, 9 Apr 2026 23:04:15 +0530 Subject: [PATCH] net: qrtr: ns: Limit the total number of nodes 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 diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c index 1b9a90240a68..c0418764470b 100644 --- a/net/qrtr/ns.c +++ b/net/qrtr/ns.c @@ -71,12 +71,16 @@ struct qrtr_node { u32 server_count; }; -/* Max server, lookup limits are chosen based on the current platform requirements. - * If the requirement changes in the future, these values can be increased. +/* 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; @@ -85,6 +89,11 @@ static struct qrtr_node *node_get(unsigned int node_id) 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_obj(*node); if (!node) @@ -98,6 +107,8 @@ static struct qrtr_node *node_get(unsigned int node_id) return NULL; } + node_count++; + return node; } @@ -404,6 +415,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) delete_node: xa_erase(&nodes, from->sq_node); kfree(node); + node_count--; return ret; }