diff options
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index ffdad8e842ac..f00b03845247 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -607,9 +607,8 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
607 | int cnt; | 607 | int cnt; |
608 | struct sctp_bind_addr *bp = &ep->base.bind_addr; | 608 | struct sctp_bind_addr *bp = &ep->base.bind_addr; |
609 | int retval = 0; | 609 | int retval = 0; |
610 | union sctp_addr saveaddr; | ||
611 | void *addr_buf; | 610 | void *addr_buf; |
612 | struct sockaddr *sa_addr; | 611 | union sctp_addr *sa_addr; |
613 | struct sctp_af *af; | 612 | struct sctp_af *af; |
614 | 613 | ||
615 | SCTP_DEBUG_PRINTK("sctp_bindx_rem (sk: %p, addrs: %p, addrcnt: %d)\n", | 614 | SCTP_DEBUG_PRINTK("sctp_bindx_rem (sk: %p, addrs: %p, addrcnt: %d)\n", |
@@ -627,19 +626,13 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
627 | goto err_bindx_rem; | 626 | goto err_bindx_rem; |
628 | } | 627 | } |
629 | 628 | ||
630 | /* The list may contain either IPv4 or IPv6 address; | 629 | sa_addr = (union sctp_addr *)addr_buf; |
631 | * determine the address length to copy the address to | 630 | af = sctp_get_af_specific(sa_addr->sa.sa_family); |
632 | * saveaddr. | ||
633 | */ | ||
634 | sa_addr = (struct sockaddr *)addr_buf; | ||
635 | af = sctp_get_af_specific(sa_addr->sa_family); | ||
636 | if (!af) { | 631 | if (!af) { |
637 | retval = -EINVAL; | 632 | retval = -EINVAL; |
638 | goto err_bindx_rem; | 633 | goto err_bindx_rem; |
639 | } | 634 | } |
640 | memcpy(&saveaddr, sa_addr, af->sockaddr_len); | 635 | if (sa_addr->v4.sin_port != htons(bp->port)) { |
641 | saveaddr.v4.sin_port = ntohs(saveaddr.v4.sin_port); | ||
642 | if (saveaddr.v4.sin_port != bp->port) { | ||
643 | retval = -EINVAL; | 636 | retval = -EINVAL; |
644 | goto err_bindx_rem; | 637 | goto err_bindx_rem; |
645 | } | 638 | } |
@@ -654,7 +647,7 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) | |||
654 | sctp_local_bh_disable(); | 647 | sctp_local_bh_disable(); |
655 | sctp_write_lock(&ep->base.addr_lock); | 648 | sctp_write_lock(&ep->base.addr_lock); |
656 | 649 | ||
657 | retval = sctp_del_bind_addr(bp, &saveaddr); | 650 | retval = sctp_del_bind_addr(bp, sa_addr); |
658 | 651 | ||
659 | sctp_write_unlock(&ep->base.addr_lock); | 652 | sctp_write_unlock(&ep->base.addr_lock); |
660 | sctp_local_bh_enable(); | 653 | sctp_local_bh_enable(); |