• Xianting Tian's avatar
    nvme-pci: fix NULL req in completion handler · 50b7c243
    Xianting Tian authored
    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>
    50b7c243
pci.c 83.4 KB