netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: lvs-devel@vger.kernel.org, netdev@vger.kernel.org
Cc: Julius Volz <juliusv@google.com>, Vince Busam <vbusam@google.com>,
	Wensong Zhang <wensong@linux-vs.org>,
	Julian Anastasov <ja@ssi.bg>,
	Sven Wegener <sven.wegener@stealer.net>
Subject: [patch 1/3] ipvs: only unlock in ip_vs_edit_service() if already locked
Date: Tue, 16 Sep 2008 17:13:19 +1000	[thread overview]
Message-ID: <20080916071610.390873215@vergenet.net> (raw)
In-Reply-To: 20080916071318.939200044@vergenet.net

[-- Attachment #1: ip_vs_edit_service-out_unlock.patch --]
[-- Type: text/plain, Size: 1259 bytes --]

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

Signed-off-by: Simon Horman <horms@verge.net.au>

Index: lvs-2.6/net/ipv4/ipvs/ip_vs_ctl.c
===================================================================
--- lvs-2.6.orig/net/ipv4/ipvs/ip_vs_ctl.c	2008-09-16 15:16:01.000000000 +1000
+++ lvs-2.6/net/ipv4/ipvs/ip_vs_ctl.c	2008-09-16 15:16:06.000000000 +1000
@@ -1305,7 +1305,7 @@ ip_vs_edit_service(struct ip_vs_service 
 		 */
 		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 
 			 */
 			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);

-- 

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


  reply	other threads:[~2008-09-16  7:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-16  7:13 [patch 0/3] ipvs: sparse fixes Simon Horman
2008-09-16  7:13 ` Simon Horman [this message]
2008-09-20  9:48   ` [PATCH] ipvs: Fix unused label warning Sven Wegener
2008-09-21 23:57     ` Simon Horman
2008-09-16  7:13 ` [patch 2/3] ipvs: supply a valid 0 address to ip_vs_conn_new() Simon Horman
2008-09-16  9:25   ` Sven Wegener
2008-09-16 10:25     ` Simon Horman
2008-09-16  7:13 ` [patch 3/3] ipvs: add __aquire/__release annotations to ip_vs_info_seq_start/ip_vs_info_seq_stop Simon Horman
2008-09-16  9:28 ` [patch 0/3] ipvs: sparse fixes Sven Wegener
2008-09-16 11:01   ` Julius Volz
2008-09-17  0:15     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080916071610.390873215@vergenet.net \
    --to=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=juliusv@google.com \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sven.wegener@stealer.net \
    --cc=vbusam@google.com \
    --cc=wensong@linux-vs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).