From: Sagi Grimberg <sagi@grimberg.me>
To: Taehee Yoo <ap420073@gmail.com>,
linux-nvme@lists.infradead.org, kbusch@kernel.org, axboe@fb.com,
hch@lst.de, kch@nvidia.com
Cc: larrystevenwise@gmail.com, anthony.j.knapp@intel.com,
pizhenwei@bytedance.com
Subject: Re: [PATCH 2/4] nvme: fix reset uninitialized controller
Date: Tue, 3 Jan 2023 12:32:44 +0200 [thread overview]
Message-ID: <9f70dbef-ece9-93b5-5b35-e457d1fcb2c7@grimberg.me> (raw)
In-Reply-To: <20230103100357.875854-3-ap420073@gmail.com>
On 1/3/23 12:03, Taehee Yoo wrote:
> nvme-fabric controllers can be reset by
> /sys/class/nvme/nvme#/reset_controller
> echo 1 > /sys/class/nvme/nvme#/reset_controller
> The above command will call nvme_sysfs_reset().
>
> This function internally calls ctrl->reset_work synchronously or
> asynchronously.
> At this point, it doesn't sure if the controller will be reset after
> initialization.
>
> So kernel panic would occur because ctrl->reset_work dereferences
> uninitialized values.
This is strange, the reset_work func is assigned earlier than sysfs...
>
> In order to avoid this, nvme_sysfs_reset checks
> the NVME_CTRL_STARTED_ONCE flag. This flag indicates the controller is
> initialized fully. So, reset logic can be executed safely.
Same comment, the reset should fully fence the controller
initialization.
next prev parent reply other threads:[~2023-01-03 10:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 10:03 [PATCH 0/4] nvme: fix several bugs in nvme-fabric Taehee Yoo
2023-01-03 10:03 ` [PATCH 1/4] nvme: fix delete uninitialized controller Taehee Yoo
2023-01-03 10:30 ` Sagi Grimberg
2023-01-04 0:24 ` Chaitanya Kulkarni
2023-01-04 2:42 ` Taehee Yoo
2023-01-03 10:03 ` [PATCH 2/4] nvme: fix reset " Taehee Yoo
2023-01-03 10:32 ` Sagi Grimberg [this message]
2023-01-03 10:03 ` [PATCH 3/4] nvmet: fix hang in nvmet_ns_disable() Taehee Yoo
2023-01-03 10:58 ` Sagi Grimberg
2023-01-04 0:32 ` Chaitanya Kulkarni
2023-01-04 8:56 ` Taehee Yoo
2023-01-03 10:03 ` [PATCH 4/4] nvmet-tcp: fix memory leak in nvmet_tcp_free_cmd_data_in_buffers() Taehee Yoo
2023-01-03 10:54 ` Sagi Grimberg
2023-01-04 8:44 ` Taehee Yoo
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=9f70dbef-ece9-93b5-5b35-e457d1fcb2c7@grimberg.me \
--to=sagi@grimberg.me \
--cc=anthony.j.knapp@intel.com \
--cc=ap420073@gmail.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=larrystevenwise@gmail.com \
--cc=linux-nvme@lists.infradead.org \
--cc=pizhenwei@bytedance.com \
/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