Skip to content

Commit 231df15

Browse files
committed
Merge branch 'tipc'
Jon Maloy says: ==================== tipc: corrections related to tasklet job mechanism These commits correct two bugs related to tipc' service for launching functions for asynchronous execution in a separate tasklet. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 388d333 + 00ede97 commit 231df15

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
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");

net/tipc/handler.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ unsigned int tipc_k_signal(Handler routine, unsigned long argument)
5656
{
5757
struct queue_item *item;
5858

59+
spin_lock_bh(&qitem_lock);
5960
if (!handler_enabled) {
6061
pr_err("Signal request ignored by handler\n");
62+
spin_unlock_bh(&qitem_lock);
6163
return -ENOPROTOOPT;
6264
}
6365

64-
spin_lock_bh(&qitem_lock);
6566
item = kmem_cache_alloc(tipc_queue_item_cache, GFP_ATOMIC);
6667
if (!item) {
6768
pr_err("Signal queue out of memory\n");
@@ -112,10 +113,14 @@ void tipc_handler_stop(void)
112113
struct list_head *l, *n;
113114
struct queue_item *item;
114115

115-
if (!handler_enabled)
116+
spin_lock_bh(&qitem_lock);
117+
if (!handler_enabled) {
118+
spin_unlock_bh(&qitem_lock);
116119
return;
117-
120+
}
118121
handler_enabled = 0;
122+
spin_unlock_bh(&qitem_lock);
123+
119124
tasklet_kill(&tipc_tasklet);
120125

121126
spin_lock_bh(&qitem_lock);

0 commit comments

Comments
 (0)