diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-07-31 03:38:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-31 03:38:52 -0400 |
commit | 967ab999a090b1a4e7d3c7febfd6d89b42fb4cf4 (patch) | |
tree | 7ccc98a3ef1be4ca3129de23b083ab2bc47eb5c3 /net | |
parent | a8ddc9163c6a16cd62531dba1ec5020484e33b02 (diff) |
netfilter: xt_hashlimit: fix race between htable_destroy and htable_gc
Deleting a timer with del_timer doesn't guarantee, that the
timer function is not running at the moment of deletion. Thus
in the xt_hashlimit case we can get into a ticklish situation
when the htable_gc rearms the timer back and we'll actually
delete an entry with a pending timer.
Fix it with using del_timer_sync().
AFAIK del_timer_sync checks for the timer to be pending by
itself, so I remove the check.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/xt_hashlimit.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 6809af542a2c..d9418a267812 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -367,9 +367,7 @@ static void htable_gc(unsigned long htlong) | |||
367 | 367 | ||
368 | static void htable_destroy(struct xt_hashlimit_htable *hinfo) | 368 | static void htable_destroy(struct xt_hashlimit_htable *hinfo) |
369 | { | 369 | { |
370 | /* remove timer, if it is pending */ | 370 | del_timer_sync(&hinfo->timer); |
371 | if (timer_pending(&hinfo->timer)) | ||
372 | del_timer(&hinfo->timer); | ||
373 | 371 | ||
374 | /* remove proc entry */ | 372 | /* remove proc entry */ |
375 | remove_proc_entry(hinfo->pde->name, | 373 | remove_proc_entry(hinfo->pde->name, |