sctp: Use correct address family in sctp_getsockopt_peer_addrs()
authorVlad Yasevich <vladislav.yasevich@hp.com>
Sat, 1 May 2010 01:42:42 +0000 (21:42 -0400)
committerVlad Yasevich <vladislav.yasevich@hp.com>
Sat, 1 May 2010 01:42:42 +0000 (21:42 -0400)
The function should use the address family of the address when
trying to determine the length of the structure.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
net/sctp/socket.c

index 13d8229f3a9c58a5ba7705b76119ca5f96e81c5d..1282a0ed855e88ab9ae50676dc0a61d991b6ec18 100644 (file)
@@ -4384,7 +4384,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
                                transports) {
                memcpy(&temp, &from->ipaddr, sizeof(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(temp.sa.sa_family)->sockaddr_len;
                if (space_left < addrlen)
                        return -ENOMEM;
                if (copy_to_user(to, &temp, addrlen))