]> err.no Git - linux-2.6/commitdiff
[SCTP]: We need to be careful when copying to sockaddr_storage.
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Nov 2006 01:23:01 +0000 (17:23 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:27:02 +0000 (21:27 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/associola.c
net/sctp/socket.c

index fa7cda4b181351886b843dfc83b68110b99b1619..39471d3b31b974b93e7710de9a5156dc047f554f 100644 (file)
@@ -733,7 +733,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
         * user.
         */
        memset(&addr, 0, sizeof(struct sockaddr_storage));
-       flip_to_n((union sctp_addr *)&addr, &transport->ipaddr_h);
+       memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
        event = sctp_ulpevent_make_peer_addr_change(asoc, &addr,
                                0, spc_state, error, GFP_ATOMIC);
        if (event)
index e527267a0536145b631bdc724a2a38f283cdea40..adbe531fdedc5f32572cfee42b362a989e8ee2c9 100644 (file)
@@ -3202,8 +3202,8 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len,
        status.sstat_outstrms = asoc->c.sinit_num_ostreams;
        status.sstat_fragmentation_point = asoc->frag_point;
        status.sstat_primary.spinfo_assoc_id = sctp_assoc2id(transport->asoc);
-       flip_to_n((union sctp_addr *)&status.sstat_primary.spinfo_address,
-              &transport->ipaddr_h);
+       memcpy(&status.sstat_primary.spinfo_address, &transport->ipaddr,
+                       transport->af_specific->sockaddr_len);
        /* Map ipv4 address into v4-mapped-on-v6 address.  */
        sctp_get_pf_specific(sk->sk_family)->addr_v4map(sctp_sk(sk),
                (union sctp_addr *)&status.sstat_primary.spinfo_address);
@@ -4173,8 +4173,8 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
        if (!asoc->peer.primary_path)
                return -ENOTCONN;
        
-       flip_to_n((union sctp_addr *)&prim.ssp_addr,
-                 &asoc->peer.primary_path->ipaddr_h);
+       memcpy(&prim.ssp_addr, &asoc->peer.primary_path->ipaddr,
+               asoc->peer.primary_path->af_specific->sockaddr_len);
 
        sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp,
                        (union sctp_addr *)&prim.ssp_addr);