On 02/24/2017 09:51 PM, Parthasarathy Bhuvaragan wrote:
> In filter_connect, we use waitqueue_active() to check for any
> connections to wakeup. But waitqueue_active() is missing memory
> barriers while accessing the critical sections, leading to
> inconsistent results.
> 
> In this commit, we replace this with an SMB safe wq_has_sleeper().

s/SMB/SMP

> 
> Signed-off-by: Parthasarathy Bhuvaragan 
> <parthasarathy.bhuvara...@ericsson.com>
> ---
>  net/tipc/socket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index 79e628cd08a9..ce6ed0955e36 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -1577,7 +1577,7 @@ static bool filter_connect(struct tipc_sock *tsk, 
> struct sk_buff *skb)
>                       return true;
>  
>               /* If empty 'ACK-' message, wake up sleeping connect() */
> -             if (waitqueue_active(sk_sleep(sk)))
> +             if (wq_has_sleeper(rcu_dereference(sk->sk_wq)))
>                       wake_up_interruptible(sk_sleep(sk));

It will be safer if we wake up sleeping connect with sk->sk_data_ready(sk) .

>  
>               /* 'ACK-' message is neither accepted nor rejected: */
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to