]> git.proxmox.com Git - mirror_frr.git/commit - isisd/isis_circuit.c
isisd: fix segfault in the circuit p2p/bcast union
authorEmanuele Di Pascale <emanuele@voltanet.io>
Thu, 29 Oct 2020 08:51:27 +0000 (09:51 +0100)
committerEmanuele Di Pascale <emanuele@voltanet.io>
Thu, 29 Oct 2020 08:51:27 +0000 (09:51 +0100)
commit93bdc367576d15fbec935e01cac3517aa76e6ef6
tree5249b9a07bde35386f2359d1cd4605b3c8dbb821
parent4220c2cc9b69d221e8a5d0f546dd64af4f588a15
isisd: fix segfault in the circuit p2p/bcast union

The fields in the broadcast/p2p union struct in an isis circuit are
initialized when the circuit goes up, but currently this step is
skipped if the interface is passive. This can create problems if the
circuit type (referred to as network type in the config) changes from
broadcast to point-to-point. We can end up with the p2p neighbor
pointer pointing at some garbage left by the broadcast struct in the
union, which would then cause a segfault the first time we would
dereference it - for example when building the lsp, or computing the
SPF tree.

compressed backtrace of a possible crash:
 #0  0x0000555555579a9c in lsp_build at frr/isisd/isis_lsp.c:1114
 #1  0x000055555557a516 in lsp_regenerate at frr/isisd/isis_lsp.c:1301
 #2  0x000055555557aa25 in lsp_refresh at frr/isisd/isis_lsp.c:1381
 #3  0x00007ffff7b2622c in thread_call at frr/lib/thread.c:1549
 #4  0x00007ffff7ad6df4 in frr_run at frr/lib/libfrr.c:1098
 #5  0x000055555556b67f in main at frr/isisd/isis_main.c:272

isis_lsp.c:
1112 case CIRCUIT_T_P2P: {
1113 struct isis_adjacency *nei = circuit->u.p2p.neighbor;
1114 if (nei && nei->adj_state == ISIS_ADJ_UP

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
isisd/isis_circuit.c