aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/protocol.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-12 21:40:38 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-12 21:40:38 -0400
commita40a7d15ba602b547f56b7b19e0282fe4fc3dee3 (patch)
tree81eede5e751b3e5600547018285c739825a08d48 /net/sctp/protocol.c
parentab38fb04c9f8928cfaf6f4966633d783419906a1 (diff)
[SCTP]: IPv4 vs IPv6 addresses mess in sctp_inet[6]addr_event.
All IP addresses that are present in a system are duplicated on struct sctp_sockaddr_entry. They are linked in the global list called sctp_local_addr_list. And this struct unions IPv4 and IPv6 addresses. So, there can be rare case, when a sockaddr_in.sin_addr coincides with the corresponding part of the sockaddr_in6 and the notifier for IPv4 will carry away an IPv6 entry. The fix is to check the family before comparing the addresses. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r--net/sctp/protocol.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f90091a1b9ce..c2dd65d9f38d 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -647,7 +647,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
647 spin_lock_bh(&sctp_local_addr_lock); 647 spin_lock_bh(&sctp_local_addr_lock);
648 list_for_each_entry_safe(addr, temp, 648 list_for_each_entry_safe(addr, temp,
649 &sctp_local_addr_list, list) { 649 &sctp_local_addr_list, list) {
650 if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) { 650 if (addr->a.sa.sa_family == AF_INET &&
651 addr->a.v4.sin_addr.s_addr ==
652 ifa->ifa_local) {
651 found = 1; 653 found = 1;
652 addr->valid = 0; 654 addr->valid = 0;
653 list_del_rcu(&addr->list); 655 list_del_rcu(&addr->list);