The following memory leak can occur, as identified during code inspection: tipc_node_xmit() tipc_link_xmit(le->link, list, &xmitq) ... __skb_queue_purge(list); return -ENOBUFS; tipc_link_xmit() purges list but does not purge xmitq. tipc_node_xmit() does not purge xmitq either, resulting in a memory leak. Fix this issue by purging xmitq in tipc_node_xmit() when tipc_link_xmit() returns -ENOBUFS. Fixes: 4952cd3e7b47 ("tipc: refactor node xmit and fix memory leaks") Signed-off-by: Tung Nguyen --- v3: no change net/tipc/node.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/tipc/node.c b/net/tipc/node.c index 53b0993c2c23..d84b0274fefc 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -1747,10 +1747,13 @@ int tipc_node_xmit(struct net *net, struct sk_buff_head *list, spin_unlock_bh(&le->lock); tipc_node_read_unlock(n); - if (unlikely(rc == -ENOBUFS)) + if (unlikely(rc == -ENOBUFS)) { + if (!skb_queue_empty(&xmitq)) + __skb_queue_purge(&xmitq); tipc_node_link_down(n, bearer_id, false); - else + } else { tipc_bearer_xmit(net, bearer_id, &xmitq, &le->maddr, n); + } tipc_node_put(n); -- 2.53.0