提交 8ab19ea3 编写于 作者: S Sven Wegener

ipvs: Fix possible deadlock in estimator code

There is a slight chance for a deadlock in the estimator code. We can't call
del_timer_sync() while holding our lock, as the timer might be active and
spinning for the lock on another cpu. Work around this issue by using
try_to_del_timer_sync() and releasing the lock. We could actually delete the
timer outside of our lock, as the add and kill functions are only every called
from userspace via [gs]etsockopt() and are serialized by a mutex, but better
make this explicit.
Signed-off-by: NSven Wegener <sven.wegener@stealer.net>
Cc: stable <stable@kernel.org>
Acked-by: NSimon Horman <horms@verge.net.au>
上级 bc0fde2f
...@@ -170,8 +170,11 @@ void ip_vs_kill_estimator(struct ip_vs_stats *stats) ...@@ -170,8 +170,11 @@ void ip_vs_kill_estimator(struct ip_vs_stats *stats)
kfree(est); kfree(est);
killed++; killed++;
} }
if (killed && est_list == NULL) while (killed && !est_list && try_to_del_timer_sync(&est_timer) < 0) {
del_timer_sync(&est_timer); write_unlock_bh(&est_lock);
cpu_relax();
write_lock_bh(&est_lock);
}
write_unlock_bh(&est_lock); write_unlock_bh(&est_lock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册