This is a note to let you know that I've just added the patch titled mptcp: add sk_stop_timer_sync helper to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mptcp-add-sk_stop_timer_sync-helper.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 5f74f96173e3cfa084a07b98e927f8d86bcda30f Author: Geliang Tang <geliang@xxxxxxxxxx> Date: Thu Sep 24 08:30:01 2020 +0800 mptcp: add sk_stop_timer_sync helper [ Upstream commit 08b81d873126b413cda511b1ea1cbb0e99938bbd ] This patch added a new helper sk_stop_timer_sync, it deactivates a timer like sk_stop_timer, but waits for the handler to finish. Acked-by: Paolo Abeni <pabeni@xxxxxxxxxx> Signed-off-by: Geliang Tang <geliangtang@xxxxxxxxx> Reviewed-by: Mat Martineau <mathew.j.martineau@xxxxxxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Stable-dep-of: 151c9c724d05 ("tcp: properly terminate timers for kernel sockets") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/include/net/sock.h b/include/net/sock.h index 81888513b3b93..8eea17a41c1ca 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2194,6 +2194,8 @@ void sk_reset_timer(struct sock *sk, struct timer_list *timer, void sk_stop_timer(struct sock *sk, struct timer_list *timer); +void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer); + int __sk_queue_drop_skb(struct sock *sk, struct sk_buff_head *sk_queue, struct sk_buff *skb, unsigned int flags, void (*destructor)(struct sock *sk, diff --git a/net/core/sock.c b/net/core/sock.c index 62d169bcfcfa1..eaa6f1ca414d0 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2804,6 +2804,13 @@ void sk_stop_timer(struct sock *sk, struct timer_list* timer) } EXPORT_SYMBOL(sk_stop_timer); +void sk_stop_timer_sync(struct sock *sk, struct timer_list *timer) +{ + if (del_timer_sync(timer)) + __sock_put(sk); +} +EXPORT_SYMBOL(sk_stop_timer_sync); + void sock_init_data(struct socket *sock, struct sock *sk) { sk_init_common(sk);