hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/tipc/node.c
....@@ -567,7 +567,7 @@
567567 n->capabilities, &n->bc_entry.inputq1,
568568 &n->bc_entry.namedq, snd_l, &n->bc_entry.link)) {
569569 pr_warn("Broadcast rcv link creation failed, no memory\n");
570
- kfree(n);
570
+ tipc_node_put(n);
571571 n = NULL;
572572 goto exit;
573573 }
....@@ -1152,8 +1152,9 @@
11521152 bool addr_match = false;
11531153 bool sign_match = false;
11541154 bool link_up = false;
1155
+ bool link_is_reset = false;
11551156 bool accept_addr = false;
1156
- bool reset = true;
1157
+ bool reset = false;
11571158 char *if_name;
11581159 unsigned long intv;
11591160 u16 session;
....@@ -1173,14 +1174,14 @@
11731174 /* Prepare to validate requesting node's signature and media address */
11741175 l = le->link;
11751176 link_up = l && tipc_link_is_up(l);
1177
+ link_is_reset = l && tipc_link_is_reset(l);
11761178 addr_match = l && !memcmp(&le->maddr, maddr, sizeof(*maddr));
11771179 sign_match = (signature == n->signature);
11781180
11791181 /* These three flags give us eight permutations: */
11801182
11811183 if (sign_match && addr_match && link_up) {
1182
- /* All is fine. Do nothing. */
1183
- reset = false;
1184
+ /* All is fine. Ignore requests. */
11841185 /* Peer node is not a container/local namespace */
11851186 if (!n->peer_hash_mix)
11861187 n->peer_hash_mix = hash_mixes;
....@@ -1205,6 +1206,7 @@
12051206 */
12061207 accept_addr = true;
12071208 *respond = true;
1209
+ reset = true;
12081210 } else if (!sign_match && addr_match && link_up) {
12091211 /* Peer node rebooted. Two possibilities:
12101212 * - Delayed re-discovery; this link endpoint has already
....@@ -1236,6 +1238,7 @@
12361238 n->signature = signature;
12371239 accept_addr = true;
12381240 *respond = true;
1241
+ reset = true;
12391242 }
12401243
12411244 if (!accept_addr)
....@@ -1264,6 +1267,7 @@
12641267 tipc_link_fsm_evt(l, LINK_RESET_EVT);
12651268 if (n->state == NODE_FAILINGOVER)
12661269 tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT);
1270
+ link_is_reset = tipc_link_is_reset(l);
12671271 le->link = l;
12681272 n->link_cnt++;
12691273 tipc_node_calculate_timer(n, l);
....@@ -1276,7 +1280,7 @@
12761280 memcpy(&le->maddr, maddr, sizeof(*maddr));
12771281 exit:
12781282 tipc_node_write_unlock(n);
1279
- if (reset && l && !tipc_link_is_reset(l))
1283
+ if (reset && !link_is_reset)
12801284 tipc_node_link_down(n, b->identity, false);
12811285 tipc_node_put(n);
12821286 }