libnvme: fix crash on a malformed exclusion entry - #3926
Merged
igaw merged 2 commits intoAug 27, 2026
Conversation
added 2 commits
August 26, 2026 18:02
entry_matches() parsed entries with a NULL context to keep the match path silent, but tid_parse() logs a malformed token and libnvme_msg() dereferences the context. One typo in exclusions.conf crashed every caller of libnvmf_exclusion_match(), including nvme connect-all and nvme-discoverd. Pass the real context down and report at DEBUG. Matching runs on every connect attempt, so a static typo must not produce a log line per connect. A NULL context is now rejected at the parser entry point. Signed-off-by: Martin Belanger <martin.belanger@dell.com>
"nvme exclusion list" showed only drop-in names, so the entries of the main hand-edited /etc/nvme/exclusions.conf could not be listed at all. That is the file where a typo is most likely. Print every list with its entries and mark the ones that can never match. Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Any exclusion entry with an unknown key, a token without
=, or an empty value crashes every caller oflibnvmf_exclusion_match():nvme connect-all,nvme-discoverd, and anything else that consults the list.entry_matches()parsed each entry with a NULL context to keep the match path quiet, buttid_parse()logs those three cases andlibnvme_msg()dereferences the context.The fix threads the caller's real context down instead, and reports a bad entry at DEBUG. Matching runs on every connect attempt, so one static typo must not produce a log line per connect.
libnvmf_tid_parse()andlibnvmf_tid_parse_strict()now return-EINVALfor a NULL context rather than documenting it as "parse silently", which was never true.The second commit makes the typo visible where an admin would look for it.
nvme exclusion listshowed only drop-in names, so the entries of the main hand-edited/etc/nvme/exclusions.confcould not be listed at all. It now prints every list with its entries and marks the ones that can never match:--verboselogs the reason for each one.Regression tests cover the four malformed forms plus a hostname in
traddr, which was silently rejected with no diagnostic before.