Messages in this thread |  | | | Date | Sun, 19 Aug 2012 19:51:41 +0300 (EEST) | | From | Julian Anastasov <> | | Subject | Re: IPv4 BUG: held lock freed! |
| |
Hello,
On Sun, 19 Aug 2012, Eric Dumazet wrote:
> Hmm, this looks like sk_reset_timer() is called on a socket, and timer > triggers _before_ the sock_hold() > > So the timer handler decrements sk_refcnt to 0 and calls sk_free() > > Its probably a bug introduced (or uncovered) by commit 6f458dfb40 (tcp: > improve latencies of timer triggered events) > > I always found sk_reset_timer() a bit racy... > > void sk_reset_timer(struct sock *sk, struct timer_list* timer, > unsigned long expires) > { > if (!mod_timer(timer, expires)) > sock_hold(sk); // MIGHT BE TOO LATE > } > > Following should be safer...
Above code is fine as long as caller holds reference.
Your change for tcp_release_cb looks correct.
Also, may be tcp_v4_mtu_reduced is missing a check for TCP_CLOSE state? tcp_v6_mtu_reduced already has such check.
> void sk_reset_timer(struct sock *sk, struct timer_list* timer, > unsigned long expires) > {
This should not be needed:
> sock_hold(sk); > if (mod_timer(timer, expires)) > sock_put(sk); > }
Regards
-- Julian Anastasov <ja@ssi.bg>
|  |