]> git.puffer.fish Git - matthieu/frr.git/commit
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)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 17 Nov 2020 13:39:17 +0000 (16:39 +0300)
commitfe384218d2cd4b8b72830e76d8d95a7369312736
treee3d3eef9e171b89b4b1eeb68f9b391ea4b497b04
parent912524172fadc1f615562b003bf79c888f11802d
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