From ccf7c82d0a2fa65ca14edda6eeb8f5a19ee11c12 Mon Sep 17 00:00:00 2001 From: Martin George Date: Fri, 24 Apr 2026 01:03:10 +0530 Subject: [PATCH] fabrics: sanitize traddr & trsvcid handling during connect-all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During a connect-all using the JSON config file, there are instances where traddr and trsvcid end up with garbage values eventually leading to connect invalid failures: nvme connect-all -J /usr/local/etc/nvme/config.json.gen.psk.orig -vv ... connect ctrl, 'nqn=nqn.1992-08.com.netapp:sn.48391d66c0a611ecaaa5d039ea165514:subsystem.subsys_CLIENT116_0,transport=tcp,traddr=▒o,host_traddr=192.168.1.6,trsvcid=4420 ,hostnqn=nqn.2014-08.org.nvmexpress:uuid:e6550026-173e-4959-ba74-be367844bd8a,hostid=e6550026-173e-4959-ba74-be367844bd8a,dhchap_secret=DHHC-1:01:gTtZdM+d+SjkxHcCcJKuI0OQKEnIJiXFASAlNDQP94FD/lKe:,ctrl_loss_tmo=600,concat' Failed to write to /dev/nvme-fabrics: Invalid argument free(): double free detected in tcache 2 Aborted (core dumped) ... Signed-off-by: Martin George --- libnvme/src/nvme/fabrics.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libnvme/src/nvme/fabrics.c b/libnvme/src/nvme/fabrics.c index b0db83fe4c..4572b9c5b7 100644 --- a/libnvme/src/nvme/fabrics.c +++ b/libnvme/src/nvme/fabrics.c @@ -2083,6 +2083,8 @@ static int _nvmf_discovery(struct libnvme_global_ctx *ctx, int tmo = fctx->cfg.keep_alive_tmo; struct libnvmf_context nfctx = *fctx; + sanitize_discovery_log_entry(c->ctx, e); + nfctx.subsysnqn = e->subnqn; nfctx.transport = libnvmf_trtype_str(e->trtype); nfctx.traddr = e->traddr; @@ -2747,6 +2749,8 @@ static int nbft_discovery(struct libnvme_global_ctx *ctx, libnvme_ctrl_t cl; int tmo = fctx->cfg.keep_alive_tmo; + sanitize_discovery_log_entry(c->ctx, e); + nfctx.subsysnqn = e->subnqn; nfctx.transport = libnvmf_trtype_str(e->trtype); nfctx.traddr = e->traddr;