aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorVitaliy Gusev <vgusev@openvz.org>2010-03-15 21:07:51 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-16 17:15:47 -0400
commit858a18a6a2f74e8f0e5b2e9671d4b74694aba708 (patch)
treeccdb6cff136e02b47803b1fe5cec77821f6c7c9f /net
parent8440853bb70010f2f8edc26cb0f7af60da8b2c5a (diff)
route: Fix caught BUG_ON during rt_secret_rebuild_oneshot()
route: Fix caught BUG_ON during rt_secret_rebuild_oneshot() Call rt_secret_rebuild can cause BUG_ON(timer_pending(&net->ipv4.rt_secret_timer)) in add_timer as there is not any synchronization for call rt_secret_rebuild_oneshot() for the same net namespace. Also this issue affects to rt_secret_reschedule(). Thus use mod_timer enstead. Signed-off-by: Vitaliy Gusev <vgusev@openvz.org> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/route.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d9b40248b97f..a770df2493d2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -932,10 +932,8 @@ static void rt_secret_rebuild_oneshot(struct net *net)
932{ 932{
933 del_timer_sync(&net->ipv4.rt_secret_timer); 933 del_timer_sync(&net->ipv4.rt_secret_timer);
934 rt_cache_invalidate(net); 934 rt_cache_invalidate(net);
935 if (ip_rt_secret_interval) { 935 if (ip_rt_secret_interval)
936 net->ipv4.rt_secret_timer.expires += ip_rt_secret_interval; 936 mod_timer(&net->ipv4.rt_secret_timer, jiffies + ip_rt_secret_interval);
937 add_timer(&net->ipv4.rt_secret_timer);
938 }
939} 937}
940 938
941static void rt_emergency_hash_rebuild(struct net *net) 939static void rt_emergency_hash_rebuild(struct net *net)
@@ -3103,22 +3101,20 @@ static void rt_secret_reschedule(int old)
3103 rtnl_lock(); 3101 rtnl_lock();
3104 for_each_net(net) { 3102 for_each_net(net) {
3105 int deleted = del_timer_sync(&net->ipv4.rt_secret_timer); 3103 int deleted = del_timer_sync(&net->ipv4.rt_secret_timer);
3104 long time;
3106 3105
3107 if (!new) 3106 if (!new)
3108 continue; 3107 continue;
3109 3108
3110 if (deleted) { 3109 if (deleted) {
3111 long time = net->ipv4.rt_secret_timer.expires - jiffies; 3110 time = net->ipv4.rt_secret_timer.expires - jiffies;
3112 3111
3113 if (time <= 0 || (time += diff) <= 0) 3112 if (time <= 0 || (time += diff) <= 0)
3114 time = 0; 3113 time = 0;
3115
3116 net->ipv4.rt_secret_timer.expires = time;
3117 } else 3114 } else
3118 net->ipv4.rt_secret_timer.expires = new; 3115 time = new;
3119 3116
3120 net->ipv4.rt_secret_timer.expires += jiffies; 3117 mod_timer(&net->ipv4.rt_secret_timer, jiffies + time);
3121 add_timer(&net->ipv4.rt_secret_timer);
3122 } 3118 }
3123 rtnl_unlock(); 3119 rtnl_unlock();
3124} 3120}