Skip to content

Commit 993b858

Browse files
Jon Paul Maloydavem330
authored andcommitted
tipc: correct the order of stopping services at rmmod
The 'signal handler' service in TIPC is a mechanism that makes it possible to postpone execution of functions, by launcing them into a job queue for execution in a separate tasklet, independent of the launching execution thread. When we do rmmod on the tipc module, this service is stopped after the network service. At the same time, the stopping of the network service may itself launch jobs for execution, with the risk that these functions may be scheduled for execution after the data structures meant to be accessed by the job have already been deleted. We have seen this happen, most often resulting in an oops. This commit ensures that the signal handler is the very first to be stopped when TIPC is shut down, so there are no surprises during the cleanup of the other services. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 388d333 commit 993b858

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/tipc/core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ int tipc_core_start_net(unsigned long addr)
113113
static void tipc_core_stop(void)
114114
{
115115
tipc_netlink_stop();
116-
tipc_handler_stop();
117116
tipc_cfg_stop();
118117
tipc_subscr_stop();
119118
tipc_nametbl_stop();
@@ -146,9 +145,10 @@ static int tipc_core_start(void)
146145
res = tipc_subscr_start();
147146
if (!res)
148147
res = tipc_cfg_init();
149-
if (res)
148+
if (res) {
149+
tipc_handler_stop();
150150
tipc_core_stop();
151-
151+
}
152152
return res;
153153
}
154154

@@ -178,6 +178,7 @@ static int __init tipc_init(void)
178178

179179
static void __exit tipc_exit(void)
180180
{
181+
tipc_handler_stop();
181182
tipc_core_stop_net();
182183
tipc_core_stop();
183184
pr_info("Deactivated\n");

0 commit comments

Comments
 (0)