Skip to contentSkip to conversation

sctp: Do not try to search for the transport twice

PATCH Applied Vladislav Yasevich 2 participants 2 messages Aug 29, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sctp: Do not try to search for the transport twice

When removing an non-primary transport during ASCONF processing, we end up traversing the transport list
twice: once in sctp_cmd_del_non_primary, and once in sctp_assoc_del_peer. We can avoid the second search and call sctp_assoc_rm_peer() instead. Found by code inspection during code reviews.

---
 net/sctp/sm_sideeffect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/sm_sideeffect.c +1 -1
index fef2acd..1543cf8 100644
@@ -954,7 +954,7 @@ static void sctp_cmd_del_non_primary(struct sctp_association *asoc)
 		t = list_entry(pos, struct sctp_transport, transports);
 		if (!sctp_cmp_addr_exact(&t->ipaddr,
 					 &asoc->peer.primary_addr)) {
-			sctp_assoc_del_peer(asoc, &t->ipaddr);
+			sctp_assoc_rm_peer(asoc, t);
 		}
 	}
 }
Signature · 1 line
1.9.3
maintainer Applied
#1 lore raw

From: Vladislav Yasevich <[email protected]>
Date: Fri, 28 Aug 2015 21:23:39 -0400

Quoted 8 lines

When removing an non-primary transport during ASCONF processing, we end up traversing the transport list
twice: once in sctp_cmd_del_non_primary, and once in sctp_assoc_del_peer. We can avoid the second search and call sctp_assoc_rm_peer() instead. Found by code inspection during code reviews.

Applied.