diff options
-rw-r--r-- | net/tipc/port.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index 6156c6740f6..3b7162c1f07 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -221,18 +221,25 @@ struct tipc_port *tipc_createport_raw(void *usr_handle, | |||
221 | p_ptr->usr_handle = usr_handle; | 221 | p_ptr->usr_handle = usr_handle; |
222 | p_ptr->max_pkt = MAX_PKT_DEFAULT; | 222 | p_ptr->max_pkt = MAX_PKT_DEFAULT; |
223 | p_ptr->ref = ref; | 223 | p_ptr->ref = ref; |
224 | msg = &p_ptr->phdr; | ||
225 | tipc_msg_init(msg, importance, TIPC_NAMED_MSG, NAMED_H_SIZE, 0); | ||
226 | msg_set_origport(msg, ref); | ||
227 | INIT_LIST_HEAD(&p_ptr->wait_list); | 224 | INIT_LIST_HEAD(&p_ptr->wait_list); |
228 | INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list); | 225 | INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list); |
229 | p_ptr->dispatcher = dispatcher; | 226 | p_ptr->dispatcher = dispatcher; |
230 | p_ptr->wakeup = wakeup; | 227 | p_ptr->wakeup = wakeup; |
231 | p_ptr->user_port = NULL; | 228 | p_ptr->user_port = NULL; |
232 | k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); | 229 | k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); |
233 | spin_lock_bh(&tipc_port_list_lock); | ||
234 | INIT_LIST_HEAD(&p_ptr->publications); | 230 | INIT_LIST_HEAD(&p_ptr->publications); |
235 | INIT_LIST_HEAD(&p_ptr->port_list); | 231 | INIT_LIST_HEAD(&p_ptr->port_list); |
232 | |||
233 | /* | ||
234 | * Must hold port list lock while initializing message header template | ||
235 | * to ensure a change to node's own network address doesn't result | ||
236 | * in template containing out-dated network address information | ||
237 | */ | ||
238 | |||
239 | spin_lock_bh(&tipc_port_list_lock); | ||
240 | msg = &p_ptr->phdr; | ||
241 | tipc_msg_init(msg, importance, TIPC_NAMED_MSG, NAMED_H_SIZE, 0); | ||
242 | msg_set_origport(msg, ref); | ||
236 | list_add_tail(&p_ptr->port_list, &ports); | 243 | list_add_tail(&p_ptr->port_list, &ports); |
237 | spin_unlock_bh(&tipc_port_list_lock); | 244 | spin_unlock_bh(&tipc_port_list_lock); |
238 | return p_ptr; | 245 | return p_ptr; |