diff options
author | Tung Nguyen <tung.quang.nguyen@est.tech> | 2025-04-03 09:24:31 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-25 10:45:06 +0200 |
commit | 09c2dcda2c551bba30710c33f6ac678ae7395389 (patch) | |
tree | 6b251f437f0451ec986820db9f4d0f235d44c7a1 /net/tipc/link.c | |
parent | ae7e9d29a3c3286e8a5d0d7e88822a3ff437d9c3 (diff) |
tipc: fix memory leak in tipc_link_xmit
[ Upstream commit 69ae94725f4fc9e75219d2d69022029c5b24bc9a ]
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>
Link: https://patch.msgid.link/20250403092431.514063-1-tung.quang.nguyen@est.tech
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index d0143823658d5..6c6d8546c5786 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1068,6 +1068,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); |