tipc: fix a memleak when sending data
authorErik Hugne <[email protected]>
Mon, 7 Jul 2014 00:38:50 +0000 (20:38 -0400)
committerDavid S. Miller <[email protected]>
Tue, 8 Jul 2014 23:10:01 +0000 (16:10 -0700)
This fixes a regression bug caused by:
067608e9d019d6477fd45dd948e81af0e5bf599f ("tipc: introduce direct
iovec to buffer chain fragmentation function")

If data is sent on a nonblocking socket and the destination link
is congested, the buffer chain is leaked. We fix this by freeing
the chain in this case.

Signed-off-by: Erik Hugne <[email protected]>
Signed-off-by: Jon Maloy <[email protected]>
Acked-by: Ying Xue <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/tipc/socket.c

index ede78b144dcfee5a37ca900c8581612bd890319e..8c5600cfcc3ed679a0371bd0c9b4aedb55270183 100644 (file)
@@ -784,8 +784,9 @@ new_mtu:
                        break;
 
                rc = tipc_wait_for_sndmsg(sock, &timeo);
+               if (rc)
+                       kfree_skb_list(buf);
        } while (!rc);
-
 exit:
        if (iocb)
                release_sock(sk);
@@ -898,6 +899,8 @@ next:
                                break;
                }
                rc = tipc_wait_for_sndpkt(sock, &timeo);
+               if (rc)
+                       kfree_skb_list(buf);
        } while (!rc);
 exit:
        if (iocb)