Skip to content

Conversation

@igaw
Copy link
Collaborator

@igaw igaw commented Nov 25, 2025

The nvme_host_get_hostid() and nvme_host_get_hostnqn() functions can return NULL when the host configuration is incomplete or invalid. Using strdup() directly on these return values causes a segmentation fault when NULL is passed to strdup().

Replace strdup() calls with xstrdup() to safely handle NULL input values.

Port of linux-nvme/libnvme#1091

The nvme_host_get_hostid() and nvme_host_get_hostnqn() functions can
return NULL when the host configuration is incomplete or invalid. Using
strdup() directly on these return values causes a segmentation fault
when NULL is passed to strdup().

Replace strdup() calls with xstrdup() to safely handle NULL input
values.

Signed-off-by: Stephen Cheng <[email protected]>
@igaw igaw merged commit 0dc339a into linux-nvme:master Nov 25, 2025
26 checks passed
@igaw igaw deleted the fix-nvme_host_get_ids branch November 25, 2025 09:37
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.

1 participant