fabrics: fix NULL dereference in nvmf_update_tls_concat
PATCH 1/1 fabrics: fix NULL dereference in nvmf_update_tls_concat
The recently added function nvmf_update_tls_concat() dereferences struct nvmf_disc_log_entry *e, but e will always be NULL when called via libnvmf_discovery_nbft(). This can result in a segmentation fault when attempting "nvme connect-all --nbft".
Check for NULL pointer before dereferencing.
Signed-off-by Stuart Hayes <[email protected]>
--- libnvme/src/nvme/fabrics.c | 3 +++ 1 file changed, 3 insertions(+)
libnvme/src/nvme/fabrics.c +3 -0
@@ -1228,6 +1228,9 @@ __public int libnvmf_disconnect_ctrl(libnvme_ctrl_t c)static void nvmf_update_tls_concat (struct nvmf_disc_log_entry *e,libnvme_ctrl_t c,libnvme_host_t h) { +if (!e) +return ; +if (e->trtype !=NVMF_TRTYPE_TCP || e->tsas.tcp.sectype ==NVMF_TCP_SECTYPE_NONE )return ;
Signature · 1 line
2.51.0
Daniel Wagner
AppliedQuoted 8 lines · Stuart Hayes
The recently added function
nvmf_update_tls_concat()dereferences structnvmf_disc_log_entry*e, but e will always be NULL when called vialibnvmf_discovery_nbft(). This can result in a segmentation fault when attempting "nvme connect-all --nbft".Check for NULL pointer before dereferencing.
[...]
Applied, thanks!
[1/1] fabrics: fix NULL dereference in nvmf_update_tls_concat
commit: 0f4fe4592005b515170bec08af9ccbfe598f8d72
Best regards,
Signature · 1 line
Daniel Wagner <[email protected]>