[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200901163927.GC2831246@dhcp-10-100-145-180.wdl.wdc.com>
Date: Tue, 1 Sep 2020 09:39:27 -0700
From: Keith Busch <kbusch@...nel.org>
To: Xianting Tian <tian.xianting@....com>
Cc: axboe@...com, hch@....de, sagi@...mberg.me,
linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] nvme-pci: check req to prevent crash in
nvme_handle_cqe()
On Mon, Aug 31, 2020 at 06:55:53PM +0800, Xianting Tian wrote:
> As blk_mq_tag_to_rq() may return null, so it should be check whether it is
> null before using it to prevent a crash.
It may return NULL if the command id exceeds the number of tags. We
already have a check for a valid command id value, so something is not
adding up here if we're still getting NULL.
> req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id);
> + if (unlikely(!req)) {
> + dev_warn(nvmeq->dev->ctrl.device,
> + "req is null(tag:%d) on queue %d\n",
> + cqe->command_id, le16_to_cpu(cqe->sq_id));
> + return;
> + }
Powered by blists - more mailing lists