summaryrefslogtreecommitdiff
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-04-19 14:17:58 (GMT)
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-05-10 20:03:53 (GMT)
commitbebc55aeffa72d8198e5c54cab9973a30e92f854 (patch)
treefe7ec71280dd2ec218e831b5849e89a8d7dc37bc /net/tipc/link.c
parent7f47f5c751c93f2ca9e7f0ef6c0915162ac9e076 (diff)
downloadlinux-fsl-qoriq-bebc55aeffa72d8198e5c54cab9973a30e92f854.tar.xz
tipc: Fix sk_buff leaks when link congestion is detected
Modifies a TIPC send routine that did not discard the outgoing sk_buff if it was not transmitted because of link congestion; this eliminates the potential for buffer leakage in the many callers who did not clean up the unsent buffer. (The two routines that previously did discard the unsent buffer have been updated to eliminate their now-redundant clean up.) Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 02b083e..2a9f44a 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -864,8 +864,9 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
if (unlikely(queue_size >= queue_limit)) {
if (imp <= TIPC_CRITICAL_IMPORTANCE) {
- return link_schedule_port(l_ptr, msg_origport(msg),
- size);
+ link_schedule_port(l_ptr, msg_origport(msg), size);
+ buf_discard(buf);
+ return -ELINKCONG;
}
buf_discard(buf);
if (imp > CONN_MANAGER) {
@@ -1069,8 +1070,6 @@ again:
if (likely(buf)) {
res = link_send_buf_fast(l_ptr, buf,
&sender->max_pkt);
- if (unlikely(res < 0))
- buf_discard(buf);
exit:
tipc_node_unlock(node);
read_unlock_bh(&tipc_net_lock);