Browse Source

[TIPC]: Fixed memory leak in tipc_link_send() when destination is unreachable

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Allan Stephens 19 years ago
parent
commit
c33d53b235
1 changed files with 5 additions and 1 deletions
  1. 5 1
      net/tipc/link.c

+ 5 - 1
net/tipc/link.c

@@ -1135,9 +1135,13 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
 	if (n_ptr) {
 	if (n_ptr) {
 		tipc_node_lock(n_ptr);
 		tipc_node_lock(n_ptr);
 		l_ptr = n_ptr->active_links[selector & 1];
 		l_ptr = n_ptr->active_links[selector & 1];
-		dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest);
 		if (l_ptr) {
 		if (l_ptr) {
+			dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest);
 			res = tipc_link_send_buf(l_ptr, buf);
 			res = tipc_link_send_buf(l_ptr, buf);
+		} else {
+			dbg("Attempt to send msg to unreachable node:\n");
+			msg_dbg(buf_msg(buf),">>>");
+			buf_discard(buf);
 		}
 		}
 		tipc_node_unlock(n_ptr);
 		tipc_node_unlock(n_ptr);
 	} else {
 	} else {