Skip to content

Commit 91a4a3e

Browse files
Tung Nguyendavem330
authored andcommitted
tipc: fix wrong socket reference counter after tipc_sk_timeout() returns
When tipc_sk_timeout() is executed but user space is grabbing ownership, this function rearms itself and returns. However, the socket reference counter is not reduced. This causes potential unexpected behavior. This commit fixes it by calling sock_put() before tipc_sk_timeout() returns in the above-mentioned case. Fixes: afe8792 ("tipc: refactor function tipc_sk_timeout()") Signed-off-by: Tung Nguyen <[email protected]> Acked-by: Ying Xue <[email protected]> Acked-by: Jon Maloy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2fe97a5 commit 91a4a3e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/tipc/socket.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,7 @@ static void tipc_sk_timeout(struct timer_list *t)
27592759
if (sock_owned_by_user(sk)) {
27602760
sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 20);
27612761
bh_unlock_sock(sk);
2762+
sock_put(sk);
27622763
return;
27632764
}
27642765

0 commit comments

Comments
 (0)