From: Tong Zhang <ztong0001@gmail.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvme: fix NULL pointer dereference
Date: Thu, 17 Sep 2020 12:56:59 -0400 [thread overview]
Message-ID: <CAA5qM4B-KpRvFuf+5YR4iOqNzic=fuYm=_seqwLoLp9+_xOqdA@mail.gmail.com> (raw)
In-Reply-To: <20200916165433.GA3675881@dhcp-10-100-145-180.wdl.wdc.com>
The command_id in CQE is writable by NVMe controller, driver should
check its sanity before using it.
- Tong
On Wed, Sep 16, 2020 at 12:54 PM Keith Busch <kbusch@kernel.org> wrote:
>
> On Wed, Sep 16, 2020 at 11:36:49AM -0400, Tong Zhang wrote:
> > @@ -960,6 +960,8 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
> > }
> >
> > req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id);
> > + if (!req)
> > + return;
>
> As I mentioned before, blk_mq_tag_to_rq() returns NULL if the tag
> exceeds the depth. We already verify the tag prior to calling this
> function, so what's the real root cause for how we're winding up with
> NULL here? I'm only asking this because it sounds like there's a bug
> somewhere else and this change is masking over it.
>
>
> > trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail);
> > if (!nvme_try_complete_req(req, cqe->status, cqe->result))
> > nvme_pci_complete_rq(req);
next prev parent reply other threads:[~2020-09-17 16:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 15:36 [PATCH] nvme: fix NULL pointer dereference Tong Zhang
2020-09-16 16:54 ` Keith Busch
2020-09-17 16:56 ` Tong Zhang [this message]
2020-09-17 17:14 ` Keith Busch
2020-09-18 0:44 ` Tong Zhang
2020-09-18 3:32 ` Tong Zhang
2020-09-18 18:38 ` Keith Busch
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='CAA5qM4B-KpRvFuf+5YR4iOqNzic=fuYm=_seqwLoLp9+_xOqdA@mail.gmail.com' \
--to=ztong0001@gmail.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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;
as well as URLs for NNTP newsgroup(s).