]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mptcp: add sk_stop_timer_sync helper
authorGeliang Tang <geliangtang@gmail.com>
Thu, 24 Sep 2020 00:30:01 +0000 (08:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:43:40 +0000 (16:43 +0100)
[ Upstream commit e6e2d465a21fd3ad98fdcedc9515fc0af2360e26 ]

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@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: 584f3742890e ("net: add sock_init_data_uid()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/sock.h
net/core/sock.c

index 976433438c6f22df212195e758e3db0698db9d34..c65baac40548af02af9f2d3461982168061eff6e 100644 (file)
@@ -2185,6 +2185,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,
index a2b12a5cf42bcd42ac22de6958c0d05288246896..6cca1ebf904aeffe164f65b685d742e98d06dbc4 100644 (file)
@@ -2882,6 +2882,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);