Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
isisd: fix _isis_spftree_del heap-use-after-free
Fix the following heap-use-after-free > ==82961==ERROR: AddressSanitizer: heap-use-after-free on address 0x6020001e4750 at pc 0x55a8cc7f63ac bp 0x7ffd6948e340 sp 0x7ffd6948e330 > READ of size 8 at 0x6020001e4750 thread T0 > #0 0x55a8cc7f63ab in isis_route_node_cleanup isisd/isis_route.c:335 > sonic-net#1 0x7ff25ec617c1 in route_node_free lib/table.c:75 > sonic-net#2 0x7ff25ec619fc in route_table_free lib/table.c:111 > sonic-net#3 0x7ff25ec61661 in route_table_finish lib/table.c:46 > sonic-net#4 0x55a8cc800d83 in _isis_spftree_del isisd/isis_spf.c:397 > sonic-net#5 0x55a8cc800e45 in isis_spftree_clear isisd/isis_spf.c:414 > sonic-net#6 0x55a8cc80bd9a in isis_run_spf isisd/isis_spf.c:2020 > sonic-net#7 0x55a8cc80c370 in isis_run_spf_with_protection isisd/isis_spf.c:2076 > sonic-net#8 0x55a8cc80cf52 in isis_run_spf_cb isisd/isis_spf.c:2165 > sonic-net#9 0x7ff25ec7c4dc in event_call lib/event.c:1970 > sonic-net#10 0x7ff25eb64423 in frr_run lib/libfrr.c:1213 > sonic-net#11 0x55a8cc7799da in main isisd/isis_main.c:318 > sonic-net#12 0x7ff25e623d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 > sonic-net#13 0x7ff25e623e3f in __libc_start_main_impl ../csu/libc-start.c:392 > sonic-net#14 0x55a8cc778e44 in _start (/usr/lib/frr/isisd+0x109e44) > > 0x6020001e4750 is located 0 bytes inside of 16-byte region [0x6020001e4750,0x6020001e4760) > freed by thread T0 here: > #0 0x7ff25f000537 in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127 > sonic-net#1 0x7ff25eb9012e in qfree lib/memory.c:130 > sonic-net#2 0x55a8cc7f6485 in isis_route_table_info_free isisd/isis_route.c:351 > sonic-net#3 0x55a8cc800cf4 in _isis_spftree_del isisd/isis_spf.c:395 > sonic-net#4 0x55a8cc800e45 in isis_spftree_clear isisd/isis_spf.c:414 > sonic-net#5 0x55a8cc80bd9a in isis_run_spf isisd/isis_spf.c:2020 > sonic-net#6 0x55a8cc80c370 in isis_run_spf_with_protection isisd/isis_spf.c:2076 > sonic-net#7 0x55a8cc80cf52 in isis_run_spf_cb isisd/isis_spf.c:2165 > sonic-net#8 0x7ff25ec7c4dc in event_call lib/event.c:1970 > sonic-net#9 0x7ff25eb64423 in frr_run lib/libfrr.c:1213 > sonic-net#10 0x55a8cc7799da in main isisd/isis_main.c:318 > sonic-net#11 0x7ff25e623d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 > > previously allocated by thread T0 here: > #0 0x7ff25f000a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 > sonic-net#1 0x7ff25eb8ffdc in qcalloc lib/memory.c:105 > sonic-net#2 0x55a8cc7f63eb in isis_route_table_info_alloc isisd/isis_route.c:343 > sonic-net#3 0x55a8cc80052a in _isis_spftree_init isisd/isis_spf.c:334 > sonic-net#4 0x55a8cc800e51 in isis_spftree_clear isisd/isis_spf.c:415 > sonic-net#5 0x55a8cc80bd9a in isis_run_spf isisd/isis_spf.c:2020 > sonic-net#6 0x55a8cc80c370 in isis_run_spf_with_protection isisd/isis_spf.c:2076 > sonic-net#7 0x55a8cc80cf52 in isis_run_spf_cb isisd/isis_spf.c:2165 > sonic-net#8 0x7ff25ec7c4dc in event_call lib/event.c:1970 > sonic-net#9 0x7ff25eb64423 in frr_run lib/libfrr.c:1213 > sonic-net#10 0x55a8cc7799da in main isisd/isis_main.c:318 > sonic-net#11 0x7ff25e623d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Fixes: 7153c3c ("isisd: update struct isis_route_info has multiple sr info by algorithm") Signed-off-by: Louis Scalbert <[email protected]> (cherry picked from commit 9fa9a9d)
- Loading branch information