Netdev List
 help / color / mirror / Atom feed
From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
To: <netdev@vger.kernel.org>
Cc: jon.maloy@ericsson.com, tipc-discussion@lists.sourceforge.net
Subject: [PATCH net v1 6/6] tipc: fix cleanup at module unload
Date: Tue, 24 Jan 2017 13:00:48 +0100	[thread overview]
Message-ID: <1485259248-21812-7-git-send-email-parthasarathy.bhuvaragan@ericsson.com> (raw)
In-Reply-To: <1485259248-21812-1-git-send-email-parthasarathy.bhuvaragan@ericsson.com>

In tipc_server_stop(), we iterate over the connections with limiting
factor as server's idr_in_use. We ignore the fact that this variable
is decremented in tipc_close_conn(), leading to premature exit.

In this commit, we iterate until the we have no connections left.

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Tested-by: John Thompson <thompa.atl@gmail.com>
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
---
 net/tipc/server.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/tipc/server.c b/net/tipc/server.c
index 04ff441b8065..3cd6402e812c 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -619,14 +619,12 @@ int tipc_server_start(struct tipc_server *s)
 void tipc_server_stop(struct tipc_server *s)
 {
 	struct tipc_conn *con;
-	int total = 0;
 	int id;
 
 	spin_lock_bh(&s->idr_lock);
-	for (id = 0; total < s->idr_in_use; id++) {
+	for (id = 0; s->idr_in_use; id++) {
 		con = idr_find(&s->conn_idr, id);
 		if (con) {
-			total++;
 			spin_unlock_bh(&s->idr_lock);
 			tipc_close_conn(con);
 			spin_lock_bh(&s->idr_lock);
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

  parent reply	other threads:[~2017-01-24 12:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 12:00 [PATCH net v1 0/6] topology server fixes for nametable soft lockup Parthasarathy Bhuvaragan
2017-01-24 12:00 ` [PATCH net v1 1/6] tipc: fix nametbl_lock soft lockup at node/link events Parthasarathy Bhuvaragan
2017-01-24 12:00 ` [PATCH net v1 2/6] tipc: add subscription refcount to avoid invalid delete Parthasarathy Bhuvaragan
2017-01-24 12:00 ` [PATCH net v1 3/6] tipc: fix connection refcount error Parthasarathy Bhuvaragan
2017-01-24 12:00 ` [PATCH net v1 4/6] tipc: fix nametbl_lock soft lockup at module exit Parthasarathy Bhuvaragan
2017-01-24 12:00 ` [PATCH net v1 5/6] tipc: ignore requests when the connection state is not CONNECTED Parthasarathy Bhuvaragan
2017-01-24 12:00 ` Parthasarathy Bhuvaragan [this message]
2017-01-24 21:16 ` [PATCH net v1 0/6] topology server fixes for nametable soft lockup David Miller

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=1485259248-21812-7-git-send-email-parthasarathy.bhuvaragan@ericsson.com \
    --to=parthasarathy.bhuvaragan@ericsson.com \
    --cc=jon.maloy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    /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