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 6C20F477E33; Tue, 16 Jun 2026 18:28:17 +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=1781634498; cv=none; b=qNeg20tk+58RcnbovvKHoxjCSqCzo01nJdaaAgEEm7TQCgnGzdd250+qqIEO1ruJgha2ODN7z8pRIGA6TxQM6LLaivt9ihYsiYgfO7T1bK5BJ8e6weDXs2pWiWdBOxWPrFyrHaj/vGhCVqSm2Iy9i5vnM38z4HCa7noJ12vwhL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781634498; c=relaxed/simple; bh=O/wWyg+Ocbv/Rd6ezFKMKDM/o6xDUWuYq0KeFO+NjIE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XGYe5aiiays3coJU19QLqMx33LSxpquYQBbt3QZt5om5X/Vg4Kpx2A8pfcfl255iElSL2qCfK0R2mbpV56tOYF+XgsYpOmVIkRSibcsDwdnoUlZI8+l5Ng2LmDZQRMO6LyjEMyfzVg9q0cisp299G6DR7S+usPP1+UjdzbK7eBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R5AFVWuW; 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="R5AFVWuW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4014D1F000E9; Tue, 16 Jun 2026 18:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781634497; bh=3QwQICISKxM+5Z83O/t1Dw/8BNNafBY9wrSjzW2V4cM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=R5AFVWuWRwIoJYSzSWZVKNF5xrs+f3n9ok4Xqv/eZicmBeDECOy8/rau90r2SKyak dhGpGsHazqM6vux2+HwHNCSWnhjWT+/b0r5Kly1grTenorEabkqxzOmErfP0VGVHv3 hdRs5gCRBcCh6qhXylQICKT2JwkaVOGDyp5IgV70= 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 5.15 276/411] net: qrtr: ns: Free the node during ctrl_cmd_bye() Date: Tue, 16 Jun 2026 20:28:34 +0530 Message-ID: <20260616145115.796109547@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145100.376842714@linuxfoundation.org> References: <20260616145100.376842714@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Manivannan Sadhasivam [ Upstream commit 68efba36446a7774ea5b971257ade049272a07ac ] A node sends the BYE packet when it is about to go down. So the nameserver should advertise the removal of the node to all remote and local observers and free the node finally. But currently, the nameserver doesn't free the node memory even after processing the BYE packet. This causes the node memory to leak. Hence, remove the node from Xarray list and free the node memory during both success and failure case of ctrl_cmd_bye(). 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-3-00a8a5ff2b51@oss.qualcomm.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/qrtr/ns.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) --- a/net/qrtr/ns.c +++ b/net/qrtr/ns.c @@ -344,7 +344,7 @@ static int ctrl_cmd_bye(struct sockaddr_ struct qrtr_node *node; unsigned long index; struct kvec iv; - int ret; + int ret = 0; iv.iov_base = &pkt; iv.iov_len = sizeof(pkt); @@ -359,8 +359,10 @@ static int ctrl_cmd_bye(struct sockaddr_ /* Advertise the removal of this client to all local servers */ local_node = node_get(qrtr_ns.local_node); - if (!local_node) - return 0; + if (!local_node) { + ret = 0; + goto delete_node; + } memset(&pkt, 0, sizeof(pkt)); pkt.cmd = cpu_to_le32(QRTR_TYPE_BYE); @@ -377,10 +379,18 @@ static int ctrl_cmd_bye(struct sockaddr_ ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt)); if (ret < 0) { pr_err("failed to send bye cmd\n"); - return ret; + goto delete_node; } } - return 0; + + /* Ignore -ENODEV */ + ret = 0; + +delete_node: + xa_erase(&nodes, from->sq_node); + kfree(node); + + return ret; } static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,