sctp: simplify sk_receive_queue locking
[cascardo/linux.git] / net / sctp / socket.c
index 96e0811..bf265a4 100644 (file)
@@ -386,7 +386,8 @@ static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
        /* Add the address to the bind address list.
         * Use GFP_ATOMIC since BHs will be disabled.
         */
-       ret = sctp_add_bind_addr(bp, addr, SCTP_ADDR_SRC, GFP_ATOMIC);
+       ret = sctp_add_bind_addr(bp, addr, af->sockaddr_len,
+                                SCTP_ADDR_SRC, GFP_ATOMIC);
 
        /* Copy back into socket for getsockname() use. */
        if (!ret) {
@@ -577,6 +578,7 @@ static int sctp_send_asconf_add_ip(struct sock              *sk,
                        af = sctp_get_af_specific(addr->v4.sin_family);
                        memcpy(&saveaddr, addr, af->sockaddr_len);
                        retval = sctp_add_bind_addr(bp, &saveaddr,
+                                                   sizeof(saveaddr),
                                                    SCTP_ADDR_NEW, GFP_ATOMIC);
                        addr_buf += af->sockaddr_len;
                }
@@ -1389,7 +1391,7 @@ static int sctp_getsockopt_connectx3(struct sock *sk, int len,
        int err = 0;
 
 #ifdef CONFIG_COMPAT
-       if (is_compat_task()) {
+       if (in_compat_syscall()) {
                struct compat_sctp_getaddrs_old param32;
 
                if (len < sizeof(param32))
@@ -6428,6 +6430,8 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait)
 
        poll_wait(file, sk_sleep(sk), wait);
 
+       sock_rps_record_flow(sk);
+
        /* A TCP-style listening socket becomes readable when the accept queue
         * is not empty.
         */
@@ -6762,13 +6766,11 @@ struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags,
                 *  However, this function was correct in any case. 8)
                 */
                if (flags & MSG_PEEK) {
-                       spin_lock_bh(&sk->sk_receive_queue.lock);
                        skb = skb_peek(&sk->sk_receive_queue);
                        if (skb)
                                atomic_inc(&skb->users);
-                       spin_unlock_bh(&sk->sk_receive_queue.lock);
                } else {
-                       skb = skb_dequeue(&sk->sk_receive_queue);
+                       skb = __skb_dequeue(&sk->sk_receive_queue);
                }
 
                if (skb)
@@ -7184,6 +7186,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
        newsk->sk_lingertime = sk->sk_lingertime;
        newsk->sk_rcvtimeo = sk->sk_rcvtimeo;
        newsk->sk_sndtimeo = sk->sk_sndtimeo;
+       newsk->sk_rxhash = sk->sk_rxhash;
 
        newinet = inet_sk(newsk);