mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 18:13:04 +00:00
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: Sven Wegener <sven.wegener@stealer.net> Acked-by: Julius Volz <juliusv@google.com> Signed-off-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
parent
e8ae43ec6d
commit
9e691ed68d
@ -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))) {
|
||||
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)
|
||||
*/
|
||||
ip_vs_bind_scheduler(svc, old_sched);
|
||||
old_sched = sched;
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
out_unlock:
|
||||
write_unlock_bh(&__ip_vs_svc_lock);
|
||||
out:
|
||||
|
||||
if (old_sched)
|
||||
ip_vs_scheduler_put(old_sched);
|
||||
|
Loading…
Reference in New Issue
Block a user