Commit ab091fe7 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/sctp-2.6

into home.osdl.org:/home/torvalds/v2.5/linux
parents ef146c9b c54c4df5
...@@ -1683,10 +1683,23 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk, ...@@ -1683,10 +1683,23 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk,
*/ */
static int sctp_setsockopt_initmsg(struct sock *sk, char *optval, int optlen) static int sctp_setsockopt_initmsg(struct sock *sk, char *optval, int optlen)
{ {
struct sctp_initmsg sinit;
struct sctp_opt *sp = sctp_sk(sk);
if (optlen != sizeof(struct sctp_initmsg)) if (optlen != sizeof(struct sctp_initmsg))
return -EINVAL; return -EINVAL;
if (copy_from_user(&sctp_sk(sk)->initmsg, optval, optlen)) if (copy_from_user(&sinit, optval, optlen))
return -EFAULT; return -EFAULT;
if (sinit.sinit_num_ostreams)
sp->initmsg.sinit_num_ostreams = sinit.sinit_num_ostreams;
if (sinit.sinit_max_instreams)
sp->initmsg.sinit_max_instreams = sinit.sinit_max_instreams;
if (sinit.sinit_max_attempts)
sp->initmsg.sinit_max_attempts = sinit.sinit_max_attempts;
if (sinit.sinit_max_init_timeo)
sp->initmsg.sinit_max_init_timeo = sinit.sinit_max_init_timeo;
return 0; return 0;
} }
...@@ -2880,6 +2893,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, ...@@ -2880,6 +2893,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
memcpy(&temp, &from->ipaddr, sizeof(temp)); memcpy(&temp, &from->ipaddr, sizeof(temp));
sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len; addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
temp.v4.sin_port = htons(temp.v4.sin_port);
if (copy_to_user(to, &temp, addrlen)) if (copy_to_user(to, &temp, addrlen))
return -EFAULT; return -EFAULT;
to += addrlen ; to += addrlen ;
...@@ -2974,6 +2988,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len, ...@@ -2974,6 +2988,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
memcpy(&temp, &from->a, sizeof(temp)); memcpy(&temp, &from->a, sizeof(temp));
sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
temp.v4.sin_port = htons(temp.v4.sin_port);
if (copy_to_user(to, &temp, addrlen)) if (copy_to_user(to, &temp, addrlen))
return -EFAULT; return -EFAULT;
to += addrlen; to += addrlen;
......
...@@ -56,8 +56,10 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out) ...@@ -56,8 +56,10 @@ static inline size_t sctp_ssnmap_size(__u16 in, __u16 out)
struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp) struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
{ {
struct sctp_ssnmap *retval; struct sctp_ssnmap *retval;
int order;
retval = kmalloc(sctp_ssnmap_size(in, out), gfp); order = get_order(sctp_ssnmap_size(in,out));
retval = (struct sctp_ssnmap *)__get_free_pages(gfp, order);
if (!retval) if (!retval)
goto fail; goto fail;
...@@ -71,7 +73,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp) ...@@ -71,7 +73,7 @@ struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, int gfp)
return retval; return retval;
fail_map: fail_map:
kfree(retval); free_pages((unsigned long)retval, order);
fail: fail:
return NULL; return NULL;
} }
...@@ -107,7 +109,9 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map) ...@@ -107,7 +109,9 @@ void sctp_ssnmap_clear(struct sctp_ssnmap *map)
void sctp_ssnmap_free(struct sctp_ssnmap *map) void sctp_ssnmap_free(struct sctp_ssnmap *map)
{ {
if (map && map->malloced) { if (map && map->malloced) {
kfree(map); free_pages((unsigned long)map,
get_order(sctp_ssnmap_size(map->in.len,
map->out.len)));
SCTP_DBG_OBJCNT_DEC(ssnmap); SCTP_DBG_OBJCNT_DEC(ssnmap);
} }
} }
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