summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTung Nguyen <tung.quang.nguyen@est.tech>2025-04-03 09:24:31 +0000
committerPaolo Abeni <pabeni@redhat.com>2025-04-08 10:15:33 +0200
commit69ae94725f4fc9e75219d2d69022029c5b24bc9a (patch)
tree38dbb8f01b9d86b26ab460f3a105c0759f9b0f81 /net
parent04efcee6ef8d0f01eef495db047e7216d6e6e38f (diff)
tipc: fix memory leak in tipc_link_xmit
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>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/link.c1
1 files changed, 1 insertions, 0 deletions
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);