]>
Commit | Line | Data |
---|---|---|
95244f99 GKH |
1 | From foo@baz Wed Dec 6 17:39:55 CET 2017 |
2 | From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> | |
3 | Date: Tue, 24 Jan 2017 13:00:48 +0100 | |
4 | Subject: tipc: fix cleanup at module unload | |
5 | ||
6 | From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> | |
7 | ||
8 | ||
9 | [ Upstream commit 35e22e49a5d6a741ebe7f2dd280b2052c3003ef7 ] | |
10 | ||
11 | In tipc_server_stop(), we iterate over the connections with limiting | |
12 | factor as server's idr_in_use. We ignore the fact that this variable | |
13 | is decremented in tipc_close_conn(), leading to premature exit. | |
14 | ||
15 | In this commit, we iterate until the we have no connections left. | |
16 | ||
17 | Acked-by: Ying Xue <ying.xue@windriver.com> | |
18 | Acked-by: Jon Maloy <jon.maloy@ericsson.com> | |
19 | Tested-by: John Thompson <thompa.atl@gmail.com> | |
20 | Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> | |
21 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
22 | Signed-off-by: Sasha Levin <alexander.levin@verizon.com> | |
23 | Signed-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); |