提交 9e691ed6 编写于 作者: S Simon Horman

ipvs: only unlock in ip_vs_edit_service() if already locked

Jumping to out unlocks __ip_vs_svc_lock, but that lock is not taken until
after code that may jump to out.

This problem was detected by sparse.

make C=1
  CHECK   net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_ctl.c:1332:2: warning: context imbalance in 'ip_vs_edit_service' - unexpected unlock
Acked-by: NSven Wegener <sven.wegener@stealer.net>
Acked-by: NJulius Volz <juliusv@google.com>
Signed-off-by: NSimon Horman <horms@verge.net.au>
上级 e8ae43ec
...@@ -1305,7 +1305,7 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u) ...@@ -1305,7 +1305,7 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u)
*/ */
if ((ret = ip_vs_unbind_scheduler(svc))) { if ((ret = ip_vs_unbind_scheduler(svc))) {
old_sched = sched; old_sched = sched;
goto out; goto out_unlock;
} }
/* /*
...@@ -1324,12 +1324,13 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u) ...@@ -1324,12 +1324,13 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u)
*/ */
ip_vs_bind_scheduler(svc, old_sched); ip_vs_bind_scheduler(svc, old_sched);
old_sched = sched; old_sched = sched;
goto out; goto out_unlock;
} }
} }
out: out_unlock:
write_unlock_bh(&__ip_vs_svc_lock); write_unlock_bh(&__ip_vs_svc_lock);
out:
if (old_sched) if (old_sched)
ip_vs_scheduler_put(old_sched); ip_vs_scheduler_put(old_sched);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册