On 10/5/20 6:34 AM, Tung Nguyen 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.

Reported-by: Thang Hoang Ngo <[email protected]>
Signed-off-by: Tung Nguyen <[email protected]>
---
  net/tipc/link.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index cef38a910107..ca0bb09482d0 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1028,6 +1028,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);
Acked-by: Jon Maloy <[email protected]>



_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to