diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-02-17 22:26:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-22 13:19:31 -0500 |
commit | eaefd1105bc431ef329599e307a07f2a36ae7872 (patch) | |
tree | 658eeed417654c8f6015d4d5f957f5a1b5e9521f /net/sunrpc | |
parent | 04cfa852ff8dab923640500ee850d19e75bacabc (diff) |
net: add __rcu annotations to sk_wq and wq
Add proper RCU annotations/verbs to sk_wq and wq members
Fix __sctp_write_space() sk_sleep() abuse (and sock->wq access)
Fix sunrpc sk_sleep() abuse too
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svcsock.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index d802e941d365..b7d435c3f19e 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -420,6 +420,7 @@ static void svc_sock_setbufsize(struct socket *sock, unsigned int snd, | |||
420 | static void svc_udp_data_ready(struct sock *sk, int count) | 420 | static void svc_udp_data_ready(struct sock *sk, int count) |
421 | { | 421 | { |
422 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; | 422 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
423 | wait_queue_head_t *wq = sk_sleep(sk); | ||
423 | 424 | ||
424 | if (svsk) { | 425 | if (svsk) { |
425 | dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n", | 426 | dprintk("svc: socket %p(inet %p), count=%d, busy=%d\n", |
@@ -428,8 +429,8 @@ static void svc_udp_data_ready(struct sock *sk, int count) | |||
428 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 429 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
429 | svc_xprt_enqueue(&svsk->sk_xprt); | 430 | svc_xprt_enqueue(&svsk->sk_xprt); |
430 | } | 431 | } |
431 | if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) | 432 | if (wq && waitqueue_active(wq)) |
432 | wake_up_interruptible(sk_sleep(sk)); | 433 | wake_up_interruptible(wq); |
433 | } | 434 | } |
434 | 435 | ||
435 | /* | 436 | /* |
@@ -438,6 +439,7 @@ static void svc_udp_data_ready(struct sock *sk, int count) | |||
438 | static void svc_write_space(struct sock *sk) | 439 | static void svc_write_space(struct sock *sk) |
439 | { | 440 | { |
440 | struct svc_sock *svsk = (struct svc_sock *)(sk->sk_user_data); | 441 | struct svc_sock *svsk = (struct svc_sock *)(sk->sk_user_data); |
442 | wait_queue_head_t *wq = sk_sleep(sk); | ||
441 | 443 | ||
442 | if (svsk) { | 444 | if (svsk) { |
443 | dprintk("svc: socket %p(inet %p), write_space busy=%d\n", | 445 | dprintk("svc: socket %p(inet %p), write_space busy=%d\n", |
@@ -445,10 +447,10 @@ static void svc_write_space(struct sock *sk) | |||
445 | svc_xprt_enqueue(&svsk->sk_xprt); | 447 | svc_xprt_enqueue(&svsk->sk_xprt); |
446 | } | 448 | } |
447 | 449 | ||
448 | if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) { | 450 | if (wq && waitqueue_active(wq)) { |
449 | dprintk("RPC svc_write_space: someone sleeping on %p\n", | 451 | dprintk("RPC svc_write_space: someone sleeping on %p\n", |
450 | svsk); | 452 | svsk); |
451 | wake_up_interruptible(sk_sleep(sk)); | 453 | wake_up_interruptible(wq); |
452 | } | 454 | } |
453 | } | 455 | } |
454 | 456 | ||
@@ -739,6 +741,7 @@ static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv) | |||
739 | static void svc_tcp_listen_data_ready(struct sock *sk, int count_unused) | 741 | static void svc_tcp_listen_data_ready(struct sock *sk, int count_unused) |
740 | { | 742 | { |
741 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; | 743 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
744 | wait_queue_head_t *wq; | ||
742 | 745 | ||
743 | dprintk("svc: socket %p TCP (listen) state change %d\n", | 746 | dprintk("svc: socket %p TCP (listen) state change %d\n", |
744 | sk, sk->sk_state); | 747 | sk, sk->sk_state); |
@@ -761,8 +764,9 @@ static void svc_tcp_listen_data_ready(struct sock *sk, int count_unused) | |||
761 | printk("svc: socket %p: no user data\n", sk); | 764 | printk("svc: socket %p: no user data\n", sk); |
762 | } | 765 | } |
763 | 766 | ||
764 | if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) | 767 | wq = sk_sleep(sk); |
765 | wake_up_interruptible_all(sk_sleep(sk)); | 768 | if (wq && waitqueue_active(wq)) |
769 | wake_up_interruptible_all(wq); | ||
766 | } | 770 | } |
767 | 771 | ||
768 | /* | 772 | /* |
@@ -771,6 +775,7 @@ static void svc_tcp_listen_data_ready(struct sock *sk, int count_unused) | |||
771 | static void svc_tcp_state_change(struct sock *sk) | 775 | static void svc_tcp_state_change(struct sock *sk) |
772 | { | 776 | { |
773 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; | 777 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
778 | wait_queue_head_t *wq = sk_sleep(sk); | ||
774 | 779 | ||
775 | dprintk("svc: socket %p TCP (connected) state change %d (svsk %p)\n", | 780 | dprintk("svc: socket %p TCP (connected) state change %d (svsk %p)\n", |
776 | sk, sk->sk_state, sk->sk_user_data); | 781 | sk, sk->sk_state, sk->sk_user_data); |
@@ -781,13 +786,14 @@ static void svc_tcp_state_change(struct sock *sk) | |||
781 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); | 786 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); |
782 | svc_xprt_enqueue(&svsk->sk_xprt); | 787 | svc_xprt_enqueue(&svsk->sk_xprt); |
783 | } | 788 | } |
784 | if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) | 789 | if (wq && waitqueue_active(wq)) |
785 | wake_up_interruptible_all(sk_sleep(sk)); | 790 | wake_up_interruptible_all(wq); |
786 | } | 791 | } |
787 | 792 | ||
788 | static void svc_tcp_data_ready(struct sock *sk, int count) | 793 | static void svc_tcp_data_ready(struct sock *sk, int count) |
789 | { | 794 | { |
790 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; | 795 | struct svc_sock *svsk = (struct svc_sock *)sk->sk_user_data; |
796 | wait_queue_head_t *wq = sk_sleep(sk); | ||
791 | 797 | ||
792 | dprintk("svc: socket %p TCP data ready (svsk %p)\n", | 798 | dprintk("svc: socket %p TCP data ready (svsk %p)\n", |
793 | sk, sk->sk_user_data); | 799 | sk, sk->sk_user_data); |
@@ -795,8 +801,8 @@ static void svc_tcp_data_ready(struct sock *sk, int count) | |||
795 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); | 801 | set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); |
796 | svc_xprt_enqueue(&svsk->sk_xprt); | 802 | svc_xprt_enqueue(&svsk->sk_xprt); |
797 | } | 803 | } |
798 | if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) | 804 | if (wq && waitqueue_active(wq)) |
799 | wake_up_interruptible(sk_sleep(sk)); | 805 | wake_up_interruptible(wq); |
800 | } | 806 | } |
801 | 807 | ||
802 | /* | 808 | /* |
@@ -1531,6 +1537,7 @@ static void svc_sock_detach(struct svc_xprt *xprt) | |||
1531 | { | 1537 | { |
1532 | struct svc_sock *svsk = container_of(xprt, struct svc_sock, sk_xprt); | 1538 | struct svc_sock *svsk = container_of(xprt, struct svc_sock, sk_xprt); |
1533 | struct sock *sk = svsk->sk_sk; | 1539 | struct sock *sk = svsk->sk_sk; |
1540 | wait_queue_head_t *wq; | ||
1534 | 1541 | ||
1535 | dprintk("svc: svc_sock_detach(%p)\n", svsk); | 1542 | dprintk("svc: svc_sock_detach(%p)\n", svsk); |
1536 | 1543 | ||
@@ -1539,8 +1546,9 @@ static void svc_sock_detach(struct svc_xprt *xprt) | |||
1539 | sk->sk_data_ready = svsk->sk_odata; | 1546 | sk->sk_data_ready = svsk->sk_odata; |
1540 | sk->sk_write_space = svsk->sk_owspace; | 1547 | sk->sk_write_space = svsk->sk_owspace; |
1541 | 1548 | ||
1542 | if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) | 1549 | wq = sk_sleep(sk); |
1543 | wake_up_interruptible(sk_sleep(sk)); | 1550 | if (wq && waitqueue_active(wq)) |
1551 | wake_up_interruptible(wq); | ||
1544 | } | 1552 | } |
1545 | 1553 | ||
1546 | /* | 1554 | /* |