Skip to contentSkip to conversation

two small nvmf fixes for 4.8

PATCH New Christoph Hellwig 3 participants 5 messages Aug 18, 2016 – Aug 19, 2016

Subsystems (2)
lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

One is a potential use after free that will actually be easy to trigger with the new default hostnqn support in nvme-cli, and the other fixes up the dependencies in the Kconfig file so that we don't always drag in the traditional NVMe PCIe driver.

author maintainer
#1 lore raw

PATCH 1/2 nvme-fabrics: get a reference when reusing a nvme_host structure

Without this we'll get a use after free after connecting two controller using the same hostnqn and then disconnecting one of them.

Signed-off-by Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/fabrics.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +3 -1
index 020302c..df7b84b 100644
@@ -47,8 +47,10 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
 
 	mutex_lock(&nvmf_hosts_mutex);
 	host = __nvmf_host_find(hostnqn);
-	if (host)
+	if (host) {
+		kref_get(&host->ref);
 		goto out_unlock;
+	}
 
 	host = kmalloc(sizeof(*host), GFP_KERNEL);
 	if (!host)
Signature · 1 line
2.1.4
author maintainer
#2 lore raw

PATCH 2/2 nvme: fabrics drivers don't need the nvme-pci driver

In reply to Christoph Hellwig

So select the NVME_CORE symbol instead of depending on BLK_DEV_NVME.

Signed-off-by Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/Kconfig   | 2 +-
 drivers/nvme/target/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/Kconfig +1 -1
index db39d53..0c644f7 100644
@@ -31,7 +31,7 @@ config NVME_FABRICS
 config NVME_RDMA
 	tristate "NVM Express over Fabrics RDMA host driver"
 	depends on INFINIBAND
-	depends on BLK_DEV_NVME
+	select NVME_CORE
 	select NVME_FABRICS
 	select SG_POOL
 	help
drivers/nvme/target/Kconfig +1 -1
index a5c31cb..3a5b9d0 100644
@@ -15,8 +15,8 @@ config NVME_TARGET
 
 config NVME_TARGET_LOOP
 	tristate "NVMe loopback device support"
-	depends on BLK_DEV_NVME
 	depends on NVME_TARGET
+	select NVME_CORE
 	select NVME_FABRICS
 	select SG_POOL
 	help
Signature · 1 line
2.1.4
Reviewed-by Jay Freyensee
#3 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig

One is a potential use after free that will actually be easy to trigger
with the new default hostnqn support in nvme-cli, and the other fixes up the dependencies in the Kconfig file so that we don't always drag in
the traditional NVMe PCIe driver.

Series looks good to me,

Reviewed-by Jay Freyensee <james_p_freyensee at linux.intel.com>
Quoted 5 lines

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

maintainer Applied
#4 lore raw
In reply to Christoph Hellwig
Quoted 5 lines

One is a potential use after free that will actually be easy to trigger with the new default hostnqn support in nvme-cli, and the other fixes up the dependencies in the Kconfig file so that we don't always drag in the traditional NVMe PCIe driver.

Queued to nvmf-4.8-rc, thanks Christoph...