Commit c9a08505 authored by Al Viro's avatar Al Viro Committed by David S. Miller

[SCTP]: Switch sctp_del_bind_addr() to net-endian.

Callers adjusted.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 63de08f4
...@@ -181,13 +181,10 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr) ...@@ -181,13 +181,10 @@ int sctp_del_bind_addr(struct sctp_bind_addr *bp, union sctp_addr *del_addr)
{ {
struct list_head *pos, *temp; struct list_head *pos, *temp;
struct sctp_sockaddr_entry *addr; struct sctp_sockaddr_entry *addr;
union sctp_addr tmp;
flip_to_n(&tmp, del_addr);
list_for_each_safe(pos, temp, &bp->address_list) { list_for_each_safe(pos, temp, &bp->address_list) {
addr = list_entry(pos, struct sctp_sockaddr_entry, list); addr = list_entry(pos, struct sctp_sockaddr_entry, list);
if (sctp_cmp_addr_exact(&addr->a, &tmp)) { if (sctp_cmp_addr_exact(&addr->a, del_addr)) {
/* Found the exact match. */ /* Found the exact match. */
list_del(pos); list_del(pos);
kfree(addr); kfree(addr);
......
...@@ -2609,7 +2609,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc, ...@@ -2609,7 +2609,7 @@ static int sctp_asconf_param_success(struct sctp_association *asoc,
case SCTP_PARAM_DEL_IP: case SCTP_PARAM_DEL_IP:
sctp_local_bh_disable(); sctp_local_bh_disable();
sctp_write_lock(&asoc->base.addr_lock); sctp_write_lock(&asoc->base.addr_lock);
retval = sctp_del_bind_addr(bp, &addr); retval = sctp_del_bind_addr(bp, &tmp);
sctp_write_unlock(&asoc->base.addr_lock); sctp_write_unlock(&asoc->base.addr_lock);
sctp_local_bh_enable(); sctp_local_bh_enable();
list_for_each(pos, &asoc->peer.transport_addr_list) { list_for_each(pos, &asoc->peer.transport_addr_list) {
......
...@@ -607,9 +607,8 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) ...@@ -607,9 +607,8 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
int cnt; int cnt;
struct sctp_bind_addr *bp = &ep->base.bind_addr; struct sctp_bind_addr *bp = &ep->base.bind_addr;
int retval = 0; int retval = 0;
union sctp_addr saveaddr;
void *addr_buf; void *addr_buf;
struct sockaddr *sa_addr; union sctp_addr *sa_addr;
struct sctp_af *af; struct sctp_af *af;
SCTP_DEBUG_PRINTK("sctp_bindx_rem (sk: %p, addrs: %p, addrcnt: %d)\n", 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,19 +626,13 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
goto err_bindx_rem; goto err_bindx_rem;
} }
/* The list may contain either IPv4 or IPv6 address; sa_addr = (union sctp_addr *)addr_buf;
* determine the address length to copy the address to af = sctp_get_af_specific(sa_addr->sa.sa_family);
* saveaddr.
*/
sa_addr = (struct sockaddr *)addr_buf;
af = sctp_get_af_specific(sa_addr->sa_family);
if (!af) { if (!af) {
retval = -EINVAL; retval = -EINVAL;
goto err_bindx_rem; goto err_bindx_rem;
} }
memcpy(&saveaddr, sa_addr, af->sockaddr_len); if (sa_addr->v4.sin_port != htons(bp->port)) {
saveaddr.v4.sin_port = ntohs(saveaddr.v4.sin_port);
if (saveaddr.v4.sin_port != bp->port) {
retval = -EINVAL; retval = -EINVAL;
goto err_bindx_rem; goto err_bindx_rem;
} }
...@@ -654,7 +647,7 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) ...@@ -654,7 +647,7 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
sctp_local_bh_disable(); sctp_local_bh_disable();
sctp_write_lock(&ep->base.addr_lock); sctp_write_lock(&ep->base.addr_lock);
retval = sctp_del_bind_addr(bp, &saveaddr); retval = sctp_del_bind_addr(bp, sa_addr);
sctp_write_unlock(&ep->base.addr_lock); sctp_write_unlock(&ep->base.addr_lock);
sctp_local_bh_enable(); sctp_local_bh_enable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment