]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-pci: fix NULL pointer reference in nvme_alloc_ns
authorJianchao Wang <jianchao.w.wang@oracle.com>
Sat, 6 Jan 2018 00:01:58 +0000 (08:01 +0800)
committerChristoph Hellwig <hch@lst.de>
Mon, 8 Jan 2018 10:02:13 +0000 (11:02 +0100)
commit0bf5f29dd07fdd0343b03e3b676bb1ca59fc75cf
tree011f05d2455d427dfa8e0a2cdff709c19366dcad
parent97b56e586e83b809239fc47196c71e5d2c467d60
nvme-pci: fix NULL pointer reference in nvme_alloc_ns

When the io queues setup or tagset allocation failed, ctrl.tagset is
NULL.  But the scan work will still be queued and executed, then panic
comes up due to NULL pointer reference of ctrl.tagset.

To fix this, add a new ctrl state NVME_CTRL_ADMIN_ONLY to inidcate only
admin queue is live. When non io queues or tagset allocation failed, ctrl
enters into this state, scan work will not be started.  But async event
work and nvme dev ioctl will be still available.  This will be helpful to
do further investigation and recovery.

Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c