]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-pci: fix out of bounds access in nvme_cqe_pending
authorHongbo Yao <yaohongbo@huawei.com>
Mon, 7 Jan 2019 02:22:07 +0000 (10:22 +0800)
committerChristoph Hellwig <hch@lst.de>
Wed, 9 Jan 2019 18:47:05 +0000 (13:47 -0500)
commitbac9e524de1eb2b06e44c0797e37ce52198a1c6f
treef2c10b033b953198237cc513edf5d73df9aff69b
parent1f1587bae1ee29d652f3d8bf1d7cc10cdc0e0409
nvme-pci: fix out of bounds access in nvme_cqe_pending

There is an out of bounds array access in nvme_cqe_peding().

When enable irq_thread for nvme interrupt, there is racing between the
nvmeq->cq_head updating and reading.

nvmeq->cq_head is updated in nvme_update_cq_head(), if nvmeq->cq_head
equals nvmeq->q_depth and before its value set to zero, nvme_cqe_pending()
uses its value as an array index, the index will be out of bounds.

Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
[hch: slight coding style update]
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c