Skip to content

Commit

Permalink
Merge pull request #10232 from FRRouting/mergify/bp/stable/8.0/pr-10213
Browse files Browse the repository at this point in the history
isisd: fix use after free (backport #10213)
  • Loading branch information
ton31337 committed Dec 20, 2021
2 parents 33bb907 + c1aa00d commit 3d09128
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions isisd/isis_adjacency.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,18 @@ void isis_adj_state_change(struct isis_adjacency **padj,
adj->flaps++;
} else if (old_state == ISIS_ADJ_UP) {
circuit->adj_state_changes++;
listnode_delete(circuit->u.bc.adjdb[level - 1],
adj);

circuit->upadjcount[level - 1]--;
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(circuit->tx_queue);

if (new_state == ISIS_ADJ_DOWN)
if (new_state == ISIS_ADJ_DOWN) {
listnode_delete(
circuit->u.bc.adjdb[level - 1],
adj);

del = true;
}
}

if (circuit->u.bc.lan_neighs[level - 1]) {
Expand Down Expand Up @@ -374,14 +377,17 @@ void isis_adj_state_change(struct isis_adjacency **padj,
&circuit->t_send_csnp[1]);
}
} else if (old_state == ISIS_ADJ_UP) {
if (adj->circuit->u.p2p.neighbor == adj)
adj->circuit->u.p2p.neighbor = NULL;
circuit->upadjcount[level - 1]--;
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(circuit->tx_queue);

if (new_state == ISIS_ADJ_DOWN)
if (new_state == ISIS_ADJ_DOWN) {
if (adj->circuit->u.p2p.neighbor == adj)
adj->circuit->u.p2p.neighbor =
NULL;

del = true;
}
}
}
}
Expand Down

0 comments on commit 3d09128

Please sign in to comment.