From: kensanya <kensanya@163.com>
To: "Christoph Hellwig" <hch@lst.de>
Cc: justin.tee@broadcom.com, nareshgottumukkala83@gmail.com,
paul.ely@broadcom.com, sagi@grimberg.me, kch@nvidia.com,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
TanZheng <tanzheng@kylinos.cn>
Subject: Re:Re: [PATCH] nvmet-fc: skip hostport ops when the LLDD has no host handle
Date: Thu, 15 Oct 2026 19:20:40 +0800 (CST) [thread overview]
Message-ID: <7273ecea.964a.1a13f4af93f.Coremail.kensanya@163.com> (raw)
In-Reply-To: <20261015061449.GA14497@lst.de>
At 2026-10-15 14:14:49, "Christoph Hellwig" <hch@lst.de> wrote:
>On Wed, Oct 14, 2026 at 03:53:03PM +0800, kensanya@163.com wrote:
>> From: TanZheng <tanzheng@kylinos.cn>
>>
>> nvmet_fc_alloc_hostport() returns NULL when the LLDD passes a NULL
>> hosthandle. That is not an ERR_PTR, so nvmet_fc_alloc_target_assoc()
>> keeps the association and leaves assoc->hostport NULL.
>
>A NULL hosthandle doesn't make much sense, so why do you want to handle
>that?
Hi.
nvmet_fc_rcv_ls_req() only stores the hosthandle in the iod. It does not call
nvmet_fc_alloc_hostport(). That function returns NULL for a NULL hosthandle,
and nvmet_fc_alloc_target_assoc() stores it in assoc->hostport.
The association is still created, so teardown can NULL-dereference it in nvmet_
fc_hostport_put(), and in nvmet_fc_xmt_disconnect_assoc() when ops->ls_req is set.
nvmet_fc_hostport_put() needs the same check. No hostport is allocated and
no kref is taken, but nvmet_fc_target_assoc_free() still calls nvmet_fc_hostport_put(assoc->hostport),
which does kref_put(&hostport->ref, nvmet_fc_hostport_free).
Best regard.
TanZheng.
prev parent reply other threads:[~2026-10-15 11:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 7:53 kensanya
2026-10-15 6:14 ` Christoph Hellwig
2026-10-15 11:20 ` kensanya [this message]
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=7273ecea.964a.1a13f4af93f.Coremail.kensanya@163.com \
--to=kensanya@163.com \
--cc=hch@lst.de \
--cc=justin.tee@broadcom.com \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nareshgottumukkala83@gmail.com \
--cc=paul.ely@broadcom.com \
--cc=sagi@grimberg.me \
--cc=tanzheng@kylinos.cn \
/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
all inboxes | Powered by JetHome®