]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
fabrics: avoid segfault when nvme discover fails with the -p option
authorMartin George <marting@netapp.com>
Mon, 11 Apr 2022 04:06:20 +0000 (09:36 +0530)
committerDaniel Wagner <dwagner@suse.de>
Wed, 13 Apr 2022 11:05:34 +0000 (13:05 +0200)
commitd49b74393cdbc29e7e092226083341bb9dfa8f6f
tree03a1501118b1f189d0c87f41de03423495dd6860
parent5a36baba322e7979175ed9dfeede0a96e29efc37
fabrics: avoid segfault when nvme discover fails with the -p option

If the initial discovery controller creation fails while passing
the -p option to the nvme discover (or connect-all) command, it
could lead to the below segfault:

nvme discover -t rdma -w 192.168.1.114 -a 192.168.1.113 -p
Failed to write to /dev/nvme-fabrics: Connection reset by peer
Segmentation fault (core dumped)

Avoid this segfault by checking if the controller created in
__create_discover_ctrl() is valid before proceeding.

Signed-off-by: Martin George <marting@netapp.com>
fabrics.c