]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
NVMe: Reference count pci device
authorKeith Busch <keith.busch@intel.com>
Wed, 20 Aug 2014 01:15:59 +0000 (19:15 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 4 Nov 2014 20:17:09 +0000 (13:17 -0700)
commita96d4f5c2da66a0c1537bfd8aaa868b69595476a
tree59758fc29e667a858e6d072126178ea9d709d7a7
parent062261be4e39e35bdf2fba16a4b2d8a432ae8281
NVMe: Reference count pci device

If an nvme device is removed but user space has an open reference,
the nvme driver would have been holding an invalid reference to its pci
device. You may get a general protection fault on x86 h/w when the driver
uses that reference in dma_map_sg(), as is done in nvme_map_user_pages()
from the IOCTL interface.

This patch fixes the fault by taking a reference on the pci device and
holding it even after device removal until all opens on the nvme device
are closed.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Reported-by: Nilesh Choudhury <nilesh.choudhury@oracle.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/nvme-core.c