Commit 902a53aa authored by Xianting Tian's avatar Xianting Tian Committed by Yang Yingliang
Browse files

nvme-pci: fix NULL req in completion handler



mainline inclusion
from mainline-5.9-rc7
commit 50b7c243
category: bugfix
bugzilla: 167363
CVE: NA

---------------------------

Currently, we use nvmeq->q_depth as the upper limit for a valid tag in
nvme_handle_cqe(), it is not correct. Because the available tag number
is recorded in tagset, which is not equal to nvmeq->q_depth.

The nvme driver registers interrupts for queues before initializing the
tagset, because it uses the number of successful request_irq() calls to
configure the tagset parameters. This allows a race condition with the
current tag validity check if the controller happens to produce an
interrupt with a corrupted CQE before the tagset is initialized.

Replace the driver's indirect tag check with the one already provided by
the block layer.

Signed-off-by: default avatarXianting Tian <tian.xianting@h3c.com>
Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>

Conflicts:
	drivers/nvme/host/pci.c
	[ Cleanup commit cfa27356 ("nvme-pci: remove nvmeq->tags")
	  is not applied. ]

Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 47f62e00
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment