]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
nvme-pci: fix NULL pointer dereference in nvme_free_host_mem()
authorMinwoo Im <minwoo.im.dev@gmail.com>
Fri, 24 Nov 2017 18:03:00 +0000 (03:03 +0900)
committerChristoph Hellwig <hch@lst.de>
Tue, 28 Nov 2017 16:49:26 +0000 (08:49 -0800)
commit7e5dd57ef3081ff6c03908d786ed5087f6fbb7ae
tree96909503a6a4b6a07c95daf553f27737532c8046
parenteb1bd249ba016284ed762d87c1989dd822500773
nvme-pci: fix NULL pointer dereference in nvme_free_host_mem()

Following condition which will cause NULL pointer dereference will
occur in nvme_free_host_mem() when it tries to remove pci device via
nvme_remove() especially after a failure of host memory allocation for HMB.

    "(host_mem_descs == NULL) && (nr_host_mem_descs != 0)"

It's because __nr_host_mem_descs__ is not cleared to 0 unlike
__host_mem_descs__ is so.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c