aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipvs
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2008-09-16 20:10:41 -0400
committerSimon Horman <horms@verge.net.au>2008-09-16 20:10:41 -0400
commit9e691ed68d94ab3047e028736641445b4cf74d67 (patch)
tree165104bf7462da9e61263441458795da32b6c820 /net/ipv4/ipvs
parente8ae43ec6d8fb28ceeb3eb2b9aa2de823666ba2b (diff)
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>
Diffstat (limited to 'net/ipv4/ipvs')
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 993a83fb0d56..60ca24b9ec00 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -1305,7 +1305,7 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u)
1305 */ 1305 */
1306 if ((ret = ip_vs_unbind_scheduler(svc))) { 1306 if ((ret = ip_vs_unbind_scheduler(svc))) {
1307 old_sched = sched; 1307 old_sched = sched;
1308 goto out; 1308 goto out_unlock;
1309 } 1309 }
1310 1310
1311 /* 1311 /*
@@ -1324,12 +1324,13 @@ ip_vs_edit_service(struct ip_vs_service *svc, struct ip_vs_service_user_kern *u)
1324 */ 1324 */
1325 ip_vs_bind_scheduler(svc, old_sched); 1325 ip_vs_bind_scheduler(svc, old_sched);
1326 old_sched = sched; 1326 old_sched = sched;
1327 goto out; 1327 goto out_unlock;
1328 } 1328 }
1329 } 1329 }
1330 1330
1331 out: 1331 out_unlock:
1332 write_unlock_bh(&__ip_vs_svc_lock); 1332 write_unlock_bh(&__ip_vs_svc_lock);
1333 out:
1333 1334
1334 if (old_sched) 1335 if (old_sched)
1335 ip_vs_scheduler_put(old_sched); 1336 ip_vs_scheduler_put(old_sched);