[PATCH nvme-7.3 v2 0/4] nvme-fabrics: localize string option parsing
From: raoxu
Date: Thu Aug 27 2026 - 09:14:19 EST
From: Xu Rao <raoxu@xxxxxxxxxxxxx>
nvmf_parse_options() currently uses the same temporary pointer for option
tokenization and for strings returned by match_strdup(). It also contains
several copies of the same string replacement and DH-CHAP parsing logic.
This series keeps the changes deliberately small. It separates the option
tokenizer pointer from allocated strings, factors only parsing operations
that are actually shared, and otherwise leaves option-specific code in
place.
The series is split as follows:
1/4 separates the option tokenizer pointer from the temporary pointer
used for match_strdup() results.
2/4 adds nvmf_parse_string_option() for the five direct owned-string
replacements: transport, traddr, trsvcid, host_traddr and host_iface.
3/4 reuses that helper for the subsystem NQN replacement only. The
existing NQN length check and discovery-NQN update are left
unchanged, and hostnqn and hostid are not modified.
4/4 adds nvmf_parse_dhchap_secret() for dhchap_secret and
dhchap_ctrl_secret, which share the same validation and ownership
rules, including sensitive cleanup on rejection.
This series is based on nvme-7.3 after the accepted
"nvme-fabrics: fix DHCHAP secret leak on parse failure" change.
No functional changes are intended.
Changes in v2:
- Rework 3/4 in response to Sagi's feedback. Drop the dedicated
identity helpers and limit the patch to reusing
nvmf_parse_string_option() for the subsystem NQN replacement.
- Leave hostnqn, hostid, nqnlen and the discovery-NQN code unchanged.
- Keep p for the remaining option-specific match_strdup() users.
- Keep the reviewed DH-CHAP helper logic unchanged; p remains declared
because hostnqn and hostid still use it.
- Add Sagi's Reviewed-by tags to 2/4 and 4/4.
Xu Rao (4):
nvme-fabrics: separate option tokenizer pointer
nvme-fabrics: add helper for owned string options
nvme-fabrics: reuse string helper for subsystem NQN
nvme-fabrics: add helper for DH-CHAP secret options
drivers/nvme/host/fabrics.c | 119 ++++++++++++++++--------------------
1 file changed, 54 insertions(+), 65 deletions(-)
--
2.50.1