All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] tipc: fix memory leak in tipc_link_xmit
@ 2025-04-03  9:24 Tung Nguyen
  2025-04-08  8:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Tung Nguyen @ 2025-04-03  9:24 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, edumazet, pabeni, jmaloy, Tung Nguyen

In case the backlog transmit queue for system-importance messages is overloaded,
tipc_link_xmit() returns -ENOBUFS but the skb list is not purged. This leads to
memory leak and failure when a skb is allocated.

This commit fixes this issue by purging the skb list before tipc_link_xmit()
returns.

Fixes: 365ad353c256 ("tipc: reduce risk of user starvation during link congestion")
Signed-off-by: Tung Nguyen <tung.quang.nguyen@est.tech>
---
 net/tipc/link.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index 50c2e0846ea4..18be6ff4c3db 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1046,6 +1046,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
 	if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) {
 		if (imp == TIPC_SYSTEM_IMPORTANCE) {
 			pr_warn("%s<%s>, link overflow", link_rst_msg, l->name);
+			__skb_queue_purge(list);
 			return -ENOBUFS;
 		}
 		rc = link_schedule_user(l, hdr);
-- 
2.34.1


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

* Re: [PATCH net] tipc: fix memory leak in tipc_link_xmit
  2025-04-03  9:24 [PATCH net] tipc: fix memory leak in tipc_link_xmit Tung Nguyen
@ 2025-04-08  8:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-08  8:20 UTC (permalink / raw)
  To: Tung Nguyen; +Cc: netdev, davem, kuba, edumazet, pabeni, jmaloy

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Thu,  3 Apr 2025 09:24:31 +0000 you wrote:
> In case the backlog transmit queue for system-importance messages is overloaded,
> tipc_link_xmit() returns -ENOBUFS but the skb list is not purged. This leads to
> memory leak and failure when a skb is allocated.
> 
> This commit fixes this issue by purging the skb list before tipc_link_xmit()
> returns.
> 
> [...]

Here is the summary with links:
  - [net] tipc: fix memory leak in tipc_link_xmit
    https://git.kernel.org/netdev/net/c/69ae94725f4f

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] 2+ messages in thread

end of thread, other threads:[~2025-04-08  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03  9:24 [PATCH net] tipc: fix memory leak in tipc_link_xmit Tung Nguyen
2025-04-08  8:20 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.