提交 91a4a3eb 编写于 作者: T Tung Nguyen 提交者: David S. Miller

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: afe8792f ("tipc: refactor function tipc_sk_timeout()")
Signed-off-by: NTung Nguyen <tung.q.nguyen@dektech.com.au>
Acked-by: NYing Xue <ying.xue@windriver.com>
Acked-by: NJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2fe97a57
...@@ -2759,6 +2759,7 @@ static void tipc_sk_timeout(struct timer_list *t) ...@@ -2759,6 +2759,7 @@ static void tipc_sk_timeout(struct timer_list *t)
if (sock_owned_by_user(sk)) { if (sock_owned_by_user(sk)) {
sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 20); sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 20);
bh_unlock_sock(sk); bh_unlock_sock(sk);
sock_put(sk);
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册