Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] net: qrtr: fix node refcount leak on ctrl packet alloc failure
@ 2026-05-28  8:00 Wentao Liang
  2026-05-28 14:33 ` Alexander Lobakin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wentao Liang @ 2026-05-28  8:00 UTC (permalink / raw)
  To: Manivannan Sadhasivam, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, linux-arm-msm, netdev, linux-kernel, Wentao Liang,
	stable

qrtr_send_resume_tx() calls qrtr_node_lookup() which takes a
reference on the returned node. If the subsequent call to
qrtr_alloc_ctrl_packet() fails due to memory allocation failure, the
function returns -ENOMEM without calling qrtr_node_release() to
release the node reference.

Add qrtr_node_release(node) before returning on the allocation failure
path to properly release the reference.

Cc: stable@vger.kernel.org
Fixes: cb6530b99faf ("net: qrtr: Move resume-tx transmission to recvmsg")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 net/qrtr/af_qrtr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
index 7cec6a7859b0..c9f892427f7c 100644
--- a/net/qrtr/af_qrtr.c
+++ b/net/qrtr/af_qrtr.c
@@ -1009,8 +1009,10 @@ static int qrtr_send_resume_tx(struct qrtr_cb *cb)
 		return -EINVAL;
 
 	skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL);
-	if (!skb)
+	if (!skb) {
+		qrtr_node_release(node);
 		return -ENOMEM;
+	}
 
 	pkt->cmd = cpu_to_le32(QRTR_TYPE_RESUME_TX);
 	pkt->client.node = cpu_to_le32(cb->dst_node);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-02 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28  8:00 [PATCH] net: qrtr: fix node refcount leak on ctrl packet alloc failure Wentao Liang
2026-05-28 14:33 ` Alexander Lobakin
2026-05-29 17:38 ` Manivannan Sadhasivam
2026-06-02  3:10 ` patchwork-bot+netdevbpf
2026-06-02 18:52   ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox