Commit 1ab791dc authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

ipv4: timewait: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 02ab4fca
...@@ -142,9 +142,9 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, ...@@ -142,9 +142,9 @@ void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
} }
EXPORT_SYMBOL_GPL(__inet_twsk_hashdance); EXPORT_SYMBOL_GPL(__inet_twsk_hashdance);
static void tw_timer_handler(unsigned long data) static void tw_timer_handler(struct timer_list *t)
{ {
struct inet_timewait_sock *tw = (struct inet_timewait_sock *)data; struct inet_timewait_sock *tw = from_timer(tw, t, tw_timer);
if (tw->tw_kill) if (tw->tw_kill)
__NET_INC_STATS(twsk_net(tw), LINUX_MIB_TIMEWAITKILLED); __NET_INC_STATS(twsk_net(tw), LINUX_MIB_TIMEWAITKILLED);
...@@ -188,8 +188,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, ...@@ -188,8 +188,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
tw->tw_prot = sk->sk_prot_creator; tw->tw_prot = sk->sk_prot_creator;
atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie)); atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie));
twsk_net_set(tw, sock_net(sk)); twsk_net_set(tw, sock_net(sk));
setup_pinned_timer(&tw->tw_timer, tw_timer_handler, timer_setup(&tw->tw_timer, tw_timer_handler, TIMER_PINNED);
(unsigned long)tw);
/* /*
* Because we use RCU lookups, we should not set tw_refcnt * Because we use RCU lookups, we should not set tw_refcnt
* to a non null value before everything is setup for this * to a non null value before everything is setup for this
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment