]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nvme-pci: fix var. type for increasing cq_head
authorJK Kim <jongkang.kim2@gmail.com>
Thu, 17 Jun 2021 06:02:17 +0000 (15:02 +0900)
committerChristoph Hellwig <hch@lst.de>
Thu, 17 Jun 2021 13:51:18 +0000 (15:51 +0200)
nvmeq->cq_head is compared with nvmeq->q_depth and changed the value
and cq_phase for handling the next cq db.

but, nvmeq->q_depth's type is u32 and max. value is 0x10000 when
CQP.MSQE is 0xffff and io_queue_depth is 0x10000.

current temp. variable for comparing with nvmeq->q_depth is overflowed
when previous nvmeq->cq_head is 0xffff.

in this case, nvmeq->cq_phase is not updated.
so, fix data type for temp. variable to u32.

Signed-off-by: JK Kim <jongkang.kim2@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c

index 8fbc4c87a0d86193db5e20d69b6220bad6fe9649..5a72bdf5ad0385835f703e3d6d4e4391bc097b20 100644 (file)
@@ -1032,7 +1032,7 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
 
 static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
 {
-       u16 tmp = nvmeq->cq_head + 1;
+       u32 tmp = nvmeq->cq_head + 1;
 
        if (tmp == nvmeq->q_depth) {
                nvmeq->cq_head = 0;