inet: fix races with reqsk timers
authorEric Dumazet <edumazet@google.com>
Mon, 10 Aug 2015 16:09:13 +0000 (09:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Aug 2015 04:17:29 +0000 (21:17 -0700)
commit2235f2ac75fd2501c251b0b699a9632e80239a6d
tree1d332db260b2a933ac42386c254d0d14163a1d84
parent9d332d92a95c9c67abe08b5f7cba64d8fc1e3c76
inet: fix races with reqsk timers

reqsk_queue_destroy() and reqsk_queue_unlink() should use
del_timer_sync() instead of del_timer() before calling reqsk_put(),
otherwise we could free a req still used by another cpu.

But before doing so, reqsk_queue_destroy() must release syn_wait_lock
spinlock or risk a dead lock, as reqsk_timer_handler() might
need to take this same spinlock from reqsk_queue_unlink() (called from
inet_csk_reqsk_queue_drop())

Fixes: fa76ce7328b2 ("inet: get rid of central tcp/dccp listener timer")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/request_sock.c
net/ipv4/inet_connection_sock.c