Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: linux-nvme@lists.infradead.org,
	Martin George <marting@netapp.com>,
	Daniel Wagner <wagi@kernel.org>
Cc: stuart.hayes@dell.com, Stuart Hayes <stuart.w.hayes@gmail.com>
Subject: [PATCH] fabrics: fix NULL dereference in nvmf_update_tls_concat
Date: Wed,  6 May 2026 22:53:45 +0200	[thread overview]
Message-ID: <20260506205345.64478-1-stuart.w.hayes@gmail.com> (raw)

The recently added function nvmf_update_tls_concat() dereferences struct
nvmf_disc_log_entry *e, but e will always be NULL when called via
libnvmf_discovery_nbft(). This can result in a segmentation fault when
attempting "nvme connect-all --nbft".

Check for NULL pointer before dereferencing.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
---
 libnvme/src/nvme/fabrics.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libnvme/src/nvme/fabrics.c b/libnvme/src/nvme/fabrics.c
index 4572b9c5b..326287ec6 100644
--- a/libnvme/src/nvme/fabrics.c
+++ b/libnvme/src/nvme/fabrics.c
@@ -1228,6 +1228,9 @@ __public int libnvmf_disconnect_ctrl(libnvme_ctrl_t c)
 static void nvmf_update_tls_concat(struct nvmf_disc_log_entry *e,
 		libnvme_ctrl_t c, libnvme_host_t h)
 {
+	if (!e)
+		return;
+
 	if (e->trtype != NVMF_TRTYPE_TCP ||
 	    e->tsas.tcp.sectype == NVMF_TCP_SECTYPE_NONE)
 		return;
-- 
2.51.0



             reply	other threads:[~2026-05-06 20:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 20:53 Stuart Hayes [this message]
2026-05-07 17:29 ` [PATCH] fabrics: fix NULL dereference in nvmf_update_tls_concat Daniel Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260506205345.64478-1-stuart.w.hayes@gmail.com \
    --to=stuart.w.hayes@gmail.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=marting@netapp.com \
    --cc=stuart.hayes@dell.com \
    --cc=wagi@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox