diff options
-rw-r--r-- | fs/dlm/lowcomms.c | 4 | ||||
-rw-r--r-- | include/net/sctp/sctp.h | 2 | ||||
-rw-r--r-- | net/sctp/socket.c | 62 |
3 files changed, 33 insertions, 35 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index d90909ec6aa6..ce53dffd2366 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -713,11 +713,11 @@ static void process_sctp_notification(struct connection *con, | |||
713 | return; | 713 | return; |
714 | 714 | ||
715 | /* Peel off a new sock */ | 715 | /* Peel off a new sock */ |
716 | sctp_lock_sock(con->sock->sk); | 716 | lock_sock(con->sock->sk); |
717 | ret = sctp_do_peeloff(con->sock->sk, | 717 | ret = sctp_do_peeloff(con->sock->sk, |
718 | sn->sn_assoc_change.sac_assoc_id, | 718 | sn->sn_assoc_change.sac_assoc_id, |
719 | &new_con->sock); | 719 | &new_con->sock); |
720 | sctp_release_sock(con->sock->sk); | 720 | release_sock(con->sock->sk); |
721 | if (ret < 0) { | 721 | if (ret < 0) { |
722 | log_print("Can't peel off a socket for " | 722 | log_print("Can't peel off a socket for " |
723 | "connection %d to node %d: err=%d", | 723 | "connection %d to node %d: err=%d", |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 572cd5a5292a..ec18d306bad7 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -171,8 +171,6 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly; | |||
171 | */ | 171 | */ |
172 | 172 | ||
173 | /* sock lock wrappers. */ | 173 | /* sock lock wrappers. */ |
174 | #define sctp_lock_sock(sk) lock_sock(sk) | ||
175 | #define sctp_release_sock(sk) release_sock(sk) | ||
176 | #define sctp_bh_lock_sock(sk) bh_lock_sock(sk) | 174 | #define sctp_bh_lock_sock(sk) bh_lock_sock(sk) |
177 | #define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) | 175 | #define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) |
178 | 176 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 98532cbd842e..893aa56c91cc 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -272,7 +272,7 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len) | |||
272 | { | 272 | { |
273 | int retval = 0; | 273 | int retval = 0; |
274 | 274 | ||
275 | sctp_lock_sock(sk); | 275 | lock_sock(sk); |
276 | 276 | ||
277 | pr_debug("%s: sk:%p, addr:%p, addr_len:%d\n", __func__, sk, | 277 | pr_debug("%s: sk:%p, addr:%p, addr_len:%d\n", __func__, sk, |
278 | addr, addr_len); | 278 | addr, addr_len); |
@@ -284,7 +284,7 @@ static int sctp_bind(struct sock *sk, struct sockaddr *addr, int addr_len) | |||
284 | else | 284 | else |
285 | retval = -EINVAL; | 285 | retval = -EINVAL; |
286 | 286 | ||
287 | sctp_release_sock(sk); | 287 | release_sock(sk); |
288 | 288 | ||
289 | return retval; | 289 | return retval; |
290 | } | 290 | } |
@@ -1461,7 +1461,7 @@ static void sctp_close(struct sock *sk, long timeout) | |||
1461 | 1461 | ||
1462 | pr_debug("%s: sk:%p, timeout:%ld\n", __func__, sk, timeout); | 1462 | pr_debug("%s: sk:%p, timeout:%ld\n", __func__, sk, timeout); |
1463 | 1463 | ||
1464 | sctp_lock_sock(sk); | 1464 | lock_sock(sk); |
1465 | sk->sk_shutdown = SHUTDOWN_MASK; | 1465 | sk->sk_shutdown = SHUTDOWN_MASK; |
1466 | sk->sk_state = SCTP_SS_CLOSING; | 1466 | sk->sk_state = SCTP_SS_CLOSING; |
1467 | 1467 | ||
@@ -1505,7 +1505,7 @@ static void sctp_close(struct sock *sk, long timeout) | |||
1505 | sctp_wait_for_close(sk, timeout); | 1505 | sctp_wait_for_close(sk, timeout); |
1506 | 1506 | ||
1507 | /* This will run the backlog queue. */ | 1507 | /* This will run the backlog queue. */ |
1508 | sctp_release_sock(sk); | 1508 | release_sock(sk); |
1509 | 1509 | ||
1510 | /* Supposedly, no process has access to the socket, but | 1510 | /* Supposedly, no process has access to the socket, but |
1511 | * the net layers still may. | 1511 | * the net layers still may. |
@@ -1665,7 +1665,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1665 | 1665 | ||
1666 | pr_debug("%s: about to look up association\n", __func__); | 1666 | pr_debug("%s: about to look up association\n", __func__); |
1667 | 1667 | ||
1668 | sctp_lock_sock(sk); | 1668 | lock_sock(sk); |
1669 | 1669 | ||
1670 | /* If a msg_name has been specified, assume this is to be used. */ | 1670 | /* If a msg_name has been specified, assume this is to be used. */ |
1671 | if (msg_name) { | 1671 | if (msg_name) { |
@@ -1949,7 +1949,7 @@ out_free: | |||
1949 | sctp_association_free(asoc); | 1949 | sctp_association_free(asoc); |
1950 | } | 1950 | } |
1951 | out_unlock: | 1951 | out_unlock: |
1952 | sctp_release_sock(sk); | 1952 | release_sock(sk); |
1953 | 1953 | ||
1954 | out_nounlock: | 1954 | out_nounlock: |
1955 | return sctp_error(sk, msg_flags, err); | 1955 | return sctp_error(sk, msg_flags, err); |
@@ -2035,7 +2035,7 @@ static int sctp_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
2035 | "addr_len:%p)\n", __func__, sk, msg, len, noblock, flags, | 2035 | "addr_len:%p)\n", __func__, sk, msg, len, noblock, flags, |
2036 | addr_len); | 2036 | addr_len); |
2037 | 2037 | ||
2038 | sctp_lock_sock(sk); | 2038 | lock_sock(sk); |
2039 | 2039 | ||
2040 | if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED)) { | 2040 | if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED)) { |
2041 | err = -ENOTCONN; | 2041 | err = -ENOTCONN; |
@@ -2119,7 +2119,7 @@ out_free: | |||
2119 | sctp_ulpevent_free(event); | 2119 | sctp_ulpevent_free(event); |
2120 | } | 2120 | } |
2121 | out: | 2121 | out: |
2122 | sctp_release_sock(sk); | 2122 | release_sock(sk); |
2123 | return err; | 2123 | return err; |
2124 | } | 2124 | } |
2125 | 2125 | ||
@@ -3590,7 +3590,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, | |||
3590 | goto out_nounlock; | 3590 | goto out_nounlock; |
3591 | } | 3591 | } |
3592 | 3592 | ||
3593 | sctp_lock_sock(sk); | 3593 | lock_sock(sk); |
3594 | 3594 | ||
3595 | switch (optname) { | 3595 | switch (optname) { |
3596 | case SCTP_SOCKOPT_BINDX_ADD: | 3596 | case SCTP_SOCKOPT_BINDX_ADD: |
@@ -3708,7 +3708,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, | |||
3708 | break; | 3708 | break; |
3709 | } | 3709 | } |
3710 | 3710 | ||
3711 | sctp_release_sock(sk); | 3711 | release_sock(sk); |
3712 | 3712 | ||
3713 | out_nounlock: | 3713 | out_nounlock: |
3714 | return retval; | 3714 | return retval; |
@@ -3736,7 +3736,7 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr, | |||
3736 | int err = 0; | 3736 | int err = 0; |
3737 | struct sctp_af *af; | 3737 | struct sctp_af *af; |
3738 | 3738 | ||
3739 | sctp_lock_sock(sk); | 3739 | lock_sock(sk); |
3740 | 3740 | ||
3741 | pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, | 3741 | pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, |
3742 | addr, addr_len); | 3742 | addr, addr_len); |
@@ -3752,7 +3752,7 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr, | |||
3752 | err = __sctp_connect(sk, addr, af->sockaddr_len, NULL); | 3752 | err = __sctp_connect(sk, addr, af->sockaddr_len, NULL); |
3753 | } | 3753 | } |
3754 | 3754 | ||
3755 | sctp_release_sock(sk); | 3755 | release_sock(sk); |
3756 | return err; | 3756 | return err; |
3757 | } | 3757 | } |
3758 | 3758 | ||
@@ -3778,7 +3778,7 @@ static struct sock *sctp_accept(struct sock *sk, int flags, int *err) | |||
3778 | long timeo; | 3778 | long timeo; |
3779 | int error = 0; | 3779 | int error = 0; |
3780 | 3780 | ||
3781 | sctp_lock_sock(sk); | 3781 | lock_sock(sk); |
3782 | 3782 | ||
3783 | sp = sctp_sk(sk); | 3783 | sp = sctp_sk(sk); |
3784 | ep = sp->ep; | 3784 | ep = sp->ep; |
@@ -3816,7 +3816,7 @@ static struct sock *sctp_accept(struct sock *sk, int flags, int *err) | |||
3816 | sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); | 3816 | sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); |
3817 | 3817 | ||
3818 | out: | 3818 | out: |
3819 | sctp_release_sock(sk); | 3819 | release_sock(sk); |
3820 | *err = error; | 3820 | *err = error; |
3821 | return newsk; | 3821 | return newsk; |
3822 | } | 3822 | } |
@@ -3826,7 +3826,7 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
3826 | { | 3826 | { |
3827 | int rc = -ENOTCONN; | 3827 | int rc = -ENOTCONN; |
3828 | 3828 | ||
3829 | sctp_lock_sock(sk); | 3829 | lock_sock(sk); |
3830 | 3830 | ||
3831 | /* | 3831 | /* |
3832 | * SEQPACKET-style sockets in LISTENING state are valid, for | 3832 | * SEQPACKET-style sockets in LISTENING state are valid, for |
@@ -3856,7 +3856,7 @@ static int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
3856 | break; | 3856 | break; |
3857 | } | 3857 | } |
3858 | out: | 3858 | out: |
3859 | sctp_release_sock(sk); | 3859 | release_sock(sk); |
3860 | return rc; | 3860 | return rc; |
3861 | } | 3861 | } |
3862 | 3862 | ||
@@ -5754,7 +5754,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname, | |||
5754 | if (get_user(len, optlen)) | 5754 | if (get_user(len, optlen)) |
5755 | return -EFAULT; | 5755 | return -EFAULT; |
5756 | 5756 | ||
5757 | sctp_lock_sock(sk); | 5757 | lock_sock(sk); |
5758 | 5758 | ||
5759 | switch (optname) { | 5759 | switch (optname) { |
5760 | case SCTP_STATUS: | 5760 | case SCTP_STATUS: |
@@ -5878,7 +5878,7 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname, | |||
5878 | break; | 5878 | break; |
5879 | } | 5879 | } |
5880 | 5880 | ||
5881 | sctp_release_sock(sk); | 5881 | release_sock(sk); |
5882 | return retval; | 5882 | return retval; |
5883 | } | 5883 | } |
5884 | 5884 | ||
@@ -6144,7 +6144,7 @@ int sctp_inet_listen(struct socket *sock, int backlog) | |||
6144 | if (unlikely(backlog < 0)) | 6144 | if (unlikely(backlog < 0)) |
6145 | return err; | 6145 | return err; |
6146 | 6146 | ||
6147 | sctp_lock_sock(sk); | 6147 | lock_sock(sk); |
6148 | 6148 | ||
6149 | /* Peeled-off sockets are not allowed to listen(). */ | 6149 | /* Peeled-off sockets are not allowed to listen(). */ |
6150 | if (sctp_style(sk, UDP_HIGH_BANDWIDTH)) | 6150 | if (sctp_style(sk, UDP_HIGH_BANDWIDTH)) |
@@ -6177,7 +6177,7 @@ int sctp_inet_listen(struct socket *sock, int backlog) | |||
6177 | 6177 | ||
6178 | err = 0; | 6178 | err = 0; |
6179 | out: | 6179 | out: |
6180 | sctp_release_sock(sk); | 6180 | release_sock(sk); |
6181 | return err; | 6181 | return err; |
6182 | } | 6182 | } |
6183 | 6183 | ||
@@ -6474,9 +6474,9 @@ static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p) | |||
6474 | * does not fit in the user's buffer, but this seems to be the | 6474 | * does not fit in the user's buffer, but this seems to be the |
6475 | * only way to honor MSG_DONTWAIT realistically. | 6475 | * only way to honor MSG_DONTWAIT realistically. |
6476 | */ | 6476 | */ |
6477 | sctp_release_sock(sk); | 6477 | release_sock(sk); |
6478 | *timeo_p = schedule_timeout(*timeo_p); | 6478 | *timeo_p = schedule_timeout(*timeo_p); |
6479 | sctp_lock_sock(sk); | 6479 | lock_sock(sk); |
6480 | 6480 | ||
6481 | ready: | 6481 | ready: |
6482 | finish_wait(sk_sleep(sk), &wait); | 6482 | finish_wait(sk_sleep(sk), &wait); |
@@ -6659,10 +6659,10 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, | |||
6659 | /* Let another process have a go. Since we are going | 6659 | /* Let another process have a go. Since we are going |
6660 | * to sleep anyway. | 6660 | * to sleep anyway. |
6661 | */ | 6661 | */ |
6662 | sctp_release_sock(sk); | 6662 | release_sock(sk); |
6663 | current_timeo = schedule_timeout(current_timeo); | 6663 | current_timeo = schedule_timeout(current_timeo); |
6664 | BUG_ON(sk != asoc->base.sk); | 6664 | BUG_ON(sk != asoc->base.sk); |
6665 | sctp_lock_sock(sk); | 6665 | lock_sock(sk); |
6666 | 6666 | ||
6667 | *timeo_p = current_timeo; | 6667 | *timeo_p = current_timeo; |
6668 | } | 6668 | } |
@@ -6767,9 +6767,9 @@ static int sctp_wait_for_connect(struct sctp_association *asoc, long *timeo_p) | |||
6767 | /* Let another process have a go. Since we are going | 6767 | /* Let another process have a go. Since we are going |
6768 | * to sleep anyway. | 6768 | * to sleep anyway. |
6769 | */ | 6769 | */ |
6770 | sctp_release_sock(sk); | 6770 | release_sock(sk); |
6771 | current_timeo = schedule_timeout(current_timeo); | 6771 | current_timeo = schedule_timeout(current_timeo); |
6772 | sctp_lock_sock(sk); | 6772 | lock_sock(sk); |
6773 | 6773 | ||
6774 | *timeo_p = current_timeo; | 6774 | *timeo_p = current_timeo; |
6775 | } | 6775 | } |
@@ -6812,9 +6812,9 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo) | |||
6812 | TASK_INTERRUPTIBLE); | 6812 | TASK_INTERRUPTIBLE); |
6813 | 6813 | ||
6814 | if (list_empty(&ep->asocs)) { | 6814 | if (list_empty(&ep->asocs)) { |
6815 | sctp_release_sock(sk); | 6815 | release_sock(sk); |
6816 | timeo = schedule_timeout(timeo); | 6816 | timeo = schedule_timeout(timeo); |
6817 | sctp_lock_sock(sk); | 6817 | lock_sock(sk); |
6818 | } | 6818 | } |
6819 | 6819 | ||
6820 | err = -EINVAL; | 6820 | err = -EINVAL; |
@@ -6847,9 +6847,9 @@ static void sctp_wait_for_close(struct sock *sk, long timeout) | |||
6847 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); | 6847 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
6848 | if (list_empty(&sctp_sk(sk)->ep->asocs)) | 6848 | if (list_empty(&sctp_sk(sk)->ep->asocs)) |
6849 | break; | 6849 | break; |
6850 | sctp_release_sock(sk); | 6850 | release_sock(sk); |
6851 | timeout = schedule_timeout(timeout); | 6851 | timeout = schedule_timeout(timeout); |
6852 | sctp_lock_sock(sk); | 6852 | lock_sock(sk); |
6853 | } while (!signal_pending(current) && timeout); | 6853 | } while (!signal_pending(current) && timeout); |
6854 | 6854 | ||
6855 | finish_wait(sk_sleep(sk), &wait); | 6855 | finish_wait(sk_sleep(sk), &wait); |
@@ -7046,7 +7046,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
7046 | newsk->sk_shutdown |= RCV_SHUTDOWN; | 7046 | newsk->sk_shutdown |= RCV_SHUTDOWN; |
7047 | 7047 | ||
7048 | newsk->sk_state = SCTP_SS_ESTABLISHED; | 7048 | newsk->sk_state = SCTP_SS_ESTABLISHED; |
7049 | sctp_release_sock(newsk); | 7049 | release_sock(newsk); |
7050 | } | 7050 | } |
7051 | 7051 | ||
7052 | 7052 | ||