From: Allan Stephens <allan.stephens@windriver.com>
Date: Wed, 2 Nov 2011 14:32:14 +0000 (-0400)
Subject: tipc: Minor optimization to rejection of connection-based messages
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dff10e9e637663c8c5dd0bae1a8f0e899cbb4a36;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

tipc: Minor optimization to rejection of connection-based messages

Modifies message rejection logic so that TIPC doesn't attempt to
send a FIN message to the rejecting port if it is known in advance
that there is no such message because the rejecting port doesn't exist.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---

diff --git a/net/tipc/port.c b/net/tipc/port.c
index d91efc69e6f9..ba3268b8da42 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -400,15 +400,16 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
 
 	/* send self-abort message when rejecting on a connected port */
 	if (msg_connected(msg)) {
-		struct sk_buff *abuf = NULL;
 		struct tipc_port *p_ptr = tipc_port_lock(msg_destport(msg));
 
 		if (p_ptr) {
+			struct sk_buff *abuf = NULL;
+
 			if (p_ptr->connected)
 				abuf = port_build_self_abort_msg(p_ptr, err);
 			tipc_port_unlock(p_ptr);
+			tipc_net_route_msg(abuf);
 		}
-		tipc_net_route_msg(abuf);
 	}
 
 	/* send returned message & dispose of rejected message */