]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.68/tipc-fix-cleanup-at-module-unload.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.68 / tipc-fix-cleanup-at-module-unload.patch
CommitLineData
95244f99
GKH
1From foo@baz Wed Dec 6 17:39:55 CET 2017
2From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
3Date: Tue, 24 Jan 2017 13:00:48 +0100
4Subject: tipc: fix cleanup at module unload
5
6From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
7
8
9[ Upstream commit 35e22e49a5d6a741ebe7f2dd280b2052c3003ef7 ]
10
11In tipc_server_stop(), we iterate over the connections with limiting
12factor as server's idr_in_use. We ignore the fact that this variable
13is decremented in tipc_close_conn(), leading to premature exit.
14
15In this commit, we iterate until the we have no connections left.
16
17Acked-by: Ying Xue <ying.xue@windriver.com>
18Acked-by: Jon Maloy <jon.maloy@ericsson.com>
19Tested-by: John Thompson <thompa.atl@gmail.com>
20Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
21Signed-off-by: David S. Miller <davem@davemloft.net>
22Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24---
25 net/tipc/server.c | 4 +---
26 1 file changed, 1 insertion(+), 3 deletions(-)
27
28--- a/net/tipc/server.c
29+++ b/net/tipc/server.c
30@@ -619,14 +619,12 @@ int tipc_server_start(struct tipc_server
31 void tipc_server_stop(struct tipc_server *s)
32 {
33 struct tipc_conn *con;
34- int total = 0;
35 int id;
36
37 spin_lock_bh(&s->idr_lock);
38- for (id = 0; total < s->idr_in_use; id++) {
39+ for (id = 0; s->idr_in_use; id++) {
40 con = idr_find(&s->conn_idr, id);
41 if (con) {
42- total++;
43 spin_unlock_bh(&s->idr_lock);
44 tipc_close_conn(con);
45 spin_lock_bh(&s->idr_lock);