summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTung Nguyen <tung.q.nguyen@dektech.com.au>2019-11-28 10:10:06 +0700
committerDavid S. Miller <davem@davemloft.net>2019-11-28 23:09:14 -0800
commit91a4a3eb433e4d786420c41f3c08d1d16c605962 (patch)
treeaf35c182a1071b62fcc60062ae863b85c961c407 /net
parent2fe97a578d7bad3116a89dc8a6692a51e6fc1d9c (diff)
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: afe8792fec69 ("tipc: refactor function tipc_sk_timeout()") Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au> Acked-by: Ying Xue <ying.xue@windriver.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 7baed2c2c93d..fb5595081a05 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2759,6 +2759,7 @@ static void tipc_sk_timeout(struct timer_list *t)
if (sock_owned_by_user(sk)) {
sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 20);
bh_unlock_sock(sk);
+ sock_put(sk);
return;
}