Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux: avoid segfault in check-tls-key due to null hostnqn/subsysnqn #767

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

martin-gpy
Copy link
Contributor

Running nvme check-tls-key hits a segfault as seen below:

nvme check-tls-key
-d NVMeTLSkey-1:01:bB7soUnpHfxVg53sCY21KY3nLbqLit2RcIO8Rbdf3mKhcKaM:

Segmentation fault (core dumped)

This is because the strlen check on subsysnqn or hostnqn crashes at src/nvme/linux.c due to either of them being null. Avoid this segfault by checking these strings before running a strlen on them.

Running nvme check-tls-key hits a segfault as seen below:

nvme check-tls-key
-d NVMeTLSkey-1:01:bB7soUnpHfxVg53sCY21KY3nLbqLit2RcIO8Rbdf3mKhcKaM:

Segmentation fault (core dumped)

This is because the strlen check on subsysnqn or hostnqn crashes at
src/nvme/linux.c due to either of them being null. Avoid this segfault
by checking these strings before running a strlen on them.

Signed-off-by: Martin George <[email protected]>
@igaw
Copy link
Collaborator

igaw commented Jan 18, 2024

Okay, looks reasonable. Though we should also have some saner checks in nvme-cli which prints a warning if hostnqn/hostid is missing.

@igaw igaw merged commit f46b064 into linux-nvme:master Jan 18, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants