]> www.infradead.org Git - users/sagi/libnvme.git/commit
nvme-tree: avoid segfault if auth keys are unavailable
authorMartin George <marting@netapp.com>
Fri, 26 Aug 2022 13:17:57 +0000 (18:47 +0530)
committerMartin George <marting@netapp.com>
Fri, 26 Aug 2022 13:27:35 +0000 (18:57 +0530)
commit2af8a27cf9ff16e7f8aeda6ac9b7b10baae5b8e7
tree047f7dfd4aad10bf2cc9b1053beb84626007d3a0
parent972803805869e1ddda6bb806b46070eb0b222a3f
nvme-tree: avoid segfault if auth keys are unavailable

Seeing multiple segfaults in nvme_configure_ctrl() when the
respective controller attributes (including auth keys) are
unavailable. For e.g. attempting a nvme connect with bidirectional
auth hits the following segfault:

nvme connect -t tcp -w 192.168.1.16 -a 192.168.1.116 -n
nqn.1992-08.com.netapp:sn.48391d66c0a611ecaaa5d039ea165514:subsystem.subsys_CLIENT116
-S DHHC-1:01:k+fO3MFyRpOwrPTUQh0ewZI58uf8bwn5H9RnHle4Q8U37aJe:
-C DHHC-1:03:KEVxLQLJxugDXw/tWm9VmZuas38ath9HWzpq+cDprHafC4yuVg+McEQgEltOJAIIziNfWWKaw8mpPrnSQqqQuHKE5zQ=:
Segmentation fault (core dumped)

In another instance, a segfault is seen if no keys are specified
in the nvme connect:

nvme connect -t tcp -w 192.168.1.16 -a 192.168.1.116
-n nqn.1992-08.com.netapp:sn.48391d66c0a611ecaaa5d039ea165514:subsystem.subsys_CLIENT116
Segmentation fault (core dumped)

Avoid these segfaults by checking if the respective controller attributes
(including auth keys) are available before dereferencing them.

Fixes: 6614a55 ("Parse dhchap_host_key at controller level")
Signed-off-by: Martin George <marting@netapp.com>
src/nvme/tree.c