srp_daemon: fix a double free segment fault for ibsrpdm
PATCH 1/1 srp_daemon: fix a double free segment fault for ibsrpdm
From: Honggang Li <[email protected]>
Command: ./ibsrpdm -d /dev/infiniband/umadX
Invalid free() / delete / delete[] / realloc()
at 0x4C320DC: free (vg_replace_malloc.c:540)
by 0x403BBB: free_config (srp_daemon.c:1811)
by 0x4031BE: ibsrpdm (srp_daemon.c:2113)
by 0x4031BE: main (srp_daemon.c:2153)
Address 0x5ee5fd0 is 0 bytes inside a block of size 16 free'd
at 0x4C320DC: free (vg_replace_malloc.c:540)
by 0x404851: translate_umad_to_ibdev_and_port (srp_daemon.c:729) by 0x404851: set_conf_dev_and_port (srp_daemon.c:1586) by 0x403171: ibsrpdm (srp_daemon.c:2092)
by 0x403171: main (srp_daemon.c:2153)
Block was alloc'd at
at 0x4C30EDB: malloc (vg_replace_malloc.c:309)
by 0x40478D: translate_umad_to_ibdev_and_port (srp_daemon.c:698) by 0x40478D: set_conf_dev_and_port (srp_daemon.c:1586) by 0x403171: ibsrpdm (srp_daemon.c:2092)
by 0x403171: main (srp_daemon.c:2153)
--- srp_daemon/srp_daemon.c | 1 + 1 file changed, 1 insertion(+)
srp_daemon/srp_daemon.c +1 -0
@@ -727,6 +727,7 @@ end:if (ret) {free (*ibport);free (*ibdev); + *ibdev =NULL ; }free (class_dev_path);
Signature · 1 line
2.21.0
srp_daemon/srp_daemon.c end: · line 732
Quoted 11 lines · Honggang LI
srp_daemon/srp_daemon.c +1
-0@@ -727,6 +727,7 @@ end:if (ret) {free (*ibport);free (*ibdev); + *ibdev =NULL ; }free (class_dev_path);
Quoted 22 lines · Honggang LI
From: Honggang Li <[email protected]>
Command: ./ibsrpdm -d
/dev/infiniband/umadXInvalid
free()/ delete / delete[] /realloc()
at0x4C320DC: free (vg_replace_malloc.c:540)
by0x403BBB:free_config(srp_daemon.c:1811)
by0x4031BE: ibsrpdm (srp_daemon.c:2113)
by0x4031BE: main (srp_daemon.c:2153)
Address0x5ee5fd0is 0 bytes inside a block of size 16 free'd
at0x4C320DC: free (vg_replace_malloc.c:540)
by0x404851:translate_umad_to_ibdev_and_port(srp_daemon.c:729) by0x404851:set_conf_dev_and_port(srp_daemon.c:1586) by0x403171: ibsrpdm (srp_daemon.c:2092)
by0x403171: main (srp_daemon.c:2153)
Block was alloc'd at
at0x4C30EDB: malloc (vg_replace_malloc.c:309)
by0x40478D:translate_umad_to_ibdev_and_port(srp_daemon.c:698) by0x40478D:set_conf_dev_and_port(srp_daemon.c:1586) by0x403171: ibsrpdm (srp_daemon.c:2092)
by0x403171: main (srp_daemon.c:2153)
Quoted 4 lines
Signed-off-by Honggang Li <[email protected]>--- srp_daemon/srp_daemon.c | 1 + 1 file changed, 1 insertion(+)
Queued, https://github.com/linux-rdma/rdma-core/pull/585
Thanks