* [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* Re: [PATCH] net: qrtr: fix node refcount leak on ctrl packet alloc failure
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
2 siblings, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2026-05-28 14:33 UTC (permalink / raw)
To: Wentao Liang
Cc: Manivannan Sadhasivam, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-arm-msm, netdev,
linux-kernel, stable
From: Wentao Liang <vulab@iscas.ac.cn>
Date: Thu, 28 May 2026 08:00:19 +0000
> [PATCH] net: qrtr: fix node refcount leak on ctrl packet alloc failure
Please specify the net tree in the subject prefix, i.e. [PATCH net].
> 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>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Thanks,
Olek
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: qrtr: fix node refcount leak on ctrl packet alloc failure
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
2 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2026-05-29 17:38 UTC (permalink / raw)
To: Wentao Liang
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, linux-arm-msm, netdev, linux-kernel, stable
On Thu, May 28, 2026 at 08:00:19AM +0000, Wentao Liang wrote:
> 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>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
> ---
> 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 [flat|nested] 5+ messages in thread* Re: [PATCH] net: qrtr: fix node refcount leak on ctrl packet alloc failure
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
2 siblings, 1 reply; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-02 3:10 UTC (permalink / raw)
To: Wentao Liang
Cc: mani, davem, edumazet, kuba, pabeni, horms, linux-arm-msm, netdev,
linux-kernel, stable
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 28 May 2026 08:00:19 +0000 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- net: qrtr: fix node refcount leak on ctrl packet alloc failure
https://git.kernel.org/netdev/net-next/c/3b09ff541145
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] net: qrtr: fix node refcount leak on ctrl packet alloc failure
2026-06-02 3:10 ` patchwork-bot+netdevbpf
@ 2026-06-02 18:52 ` Markus Elfring
0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2026-06-02 18:52 UTC (permalink / raw)
To: patchwork-bot+netdevbpf, vulab, netdev, linux-arm-msm,
David S. Miller, Eric Dumazet, Jakub Kicinski,
Manivannan Sadhasivam, Paolo Abeni
Cc: stable, LKML, Simon Horman
…
> > Add qrtr_node_release(node) before returning on the allocation failure
> > path to properly release the reference.
…
> Here is the summary with links:
> - net: qrtr: fix node refcount leak on ctrl packet alloc failure
> https://git.kernel.org/netdev/net-next/c/3b09ff541145
Would it have been possible to avoid a bit of duplicate source code
by using an additional label in the implementation of the function “qrtr_send_resume_tx”?
https://elixir.bootlin.com/linux/v7.1-rc6/source/net/qrtr/af_qrtr.c#L998-L1024
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.1-rc6#n526
Regards,
Markus
^ permalink raw reply [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