Skip to content

libnvme: validate context in libnvme_rescan_ctrl()#3510

Merged
igaw merged 1 commit into
linux-nvme:masterfrom
fhassan-ibm:fix-null-ptr-libnvme-rescan-ctrl
Jun 26, 2026
Merged

libnvme: validate context in libnvme_rescan_ctrl()#3510
igaw merged 1 commit into
linux-nvme:masterfrom
fhassan-ibm:fix-null-ptr-libnvme-rescan-ctrl

Conversation

@fhassan-ibm

Copy link
Copy Markdown
Contributor

libnvme_rescan_ctrl() derives the global context from the controller. The derived @ctx is then passed to libnvme_ctrl_scan_namespaces() and libnvme_ctrl_scan_paths(), both of which expect a valid context.

Instead of adding NULL checks in each callee, validate @ctx in libnvme_rescan_ctrl() and return early if no valid context is available.

This avoids propagating an invalid context to the namespace and path scan helpers.

libnvme_rescan_ctrl() derives the global context from the controller.
The derived @ctx is then passed to libnvme_ctrl_scan_namespaces() and
libnvme_ctrl_scan_paths(), both of which expect a valid context.

Instead of adding NULL checks in each callee, validate @ctx in
libnvme_rescan_ctrl() and return early if no valid context is available.

This avoids propagating an invalid context to the namespace and path
scan helpers.

Signed-off-by: Fahim Hassan <fahim.hassan@ibm.com>
@igaw igaw merged commit 4fbb15b into linux-nvme:master Jun 26, 2026
32 checks passed
@igaw

igaw commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

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