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 SMP safe wq_has_sleeper().

Signed-off-by: Parthasarathy Bhuvaragan <>
v2: Address comments from Ying Xue by replacing wq_has_sleeper()..
    with sk->sk_data_ready(sk).

Signed-off-by: Parthasarathy Bhuvaragan <>
 net/tipc/socket.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2c2ea2e15c45..cb8d2dd2b10c 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1584,8 +1584,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)))
-                       wake_up_interruptible(sk_sleep(sk));
+               sk->sk_data_ready(sk);
                /* 'ACK-' message is neither accepted nor rejected: */
                msg_set_dest_droppable(hdr, 1);

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
tipc-discussion mailing list

Reply via email to