mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH nvme-7.3 v3 0/4] nvme-fabrics: localize string option parsing
@ 2026-08-31  7:05 raoxu
  2026-08-31  7:10 ` [PATCH nvme-7.3 v3 1/4] nvme-fabrics: separate option tokenizer pointer raoxu
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: raoxu @ 2026-08-31  7:05 UTC (permalink / raw)
  To: kbusch; +Cc: axboe, hch, sagi, linux-nvme, linux-kernel, raoxu

From: Xu Rao <raoxu@uniontech.com>

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.  It reuses nvmf_parse_string_option() for the
      common replacement step and keeps only DHHC-1 validation and
      sensitive rejection cleanup in the DH-CHAP helper.

This series is based on nvme-7.3 after the accepted
"nvme-fabrics: fix DHCHAP secret leak on parse failure" change.

Changes in v3:
  - Rework 4/4 in response to Sagi's feedback.  Reuse
    nvmf_parse_string_option() for the common allocation and ownership
    transfer in nvmf_parse_dhchap_secret().
  - On DH-CHAP validation failure, free the installed value with
    kfree_sensitive() and clear the pointer before returning an error so
    normal option cleanup can run safely.
  - Keep Sagi's Reviewed-by tags on 1/4, 2/4 and 3/4.  Do not carry the
    old 4/4 Reviewed-by because the helper implementation changed.

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 | 118 ++++++++++++++++--------------------
 1 file changed, 53 insertions(+), 65 deletions(-)

-- 
2.50.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-02 13:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31  7:05 [PATCH nvme-7.3 v3 0/4] nvme-fabrics: localize string option parsing raoxu
2026-08-31  7:10 ` [PATCH nvme-7.3 v3 1/4] nvme-fabrics: separate option tokenizer pointer raoxu
2026-09-02 13:32   ` Christoph Hellwig
2026-08-31  7:11 ` [PATCH nvme-7.3 v3 2/4] nvme-fabrics: add helper for owned string options raoxu
2026-09-02 13:33   ` Christoph Hellwig
2026-08-31  7:11 ` [PATCH nvme-7.3 v3 3/4] nvme-fabrics: reuse string helper for subsystem NQN raoxu
2026-08-31  7:11 ` [PATCH nvme-7.3 v3 4/4] nvme-fabrics: add helper for DH-CHAP secret options raoxu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®