All of lore.kernel.org
 help / color / mirror / Atom feed
* two small nvmf fixes for 4.8
@ 2016-08-18 18:16 Christoph Hellwig
  2016-08-18 18:16 ` [PATCH 1/2] nvme-fabrics: get a reference when reusing a nvme_host structure Christoph Hellwig
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-08-18 18:16 UTC (permalink / 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] nvme-fabrics: get a reference when reusing a nvme_host structure
  2016-08-18 18:16 two small nvmf fixes for 4.8 Christoph Hellwig
@ 2016-08-18 18:16 ` Christoph Hellwig
  2016-08-18 18:16 ` [PATCH 2/2] nvme: fabrics drivers don't need the nvme-pci driver Christoph Hellwig
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-08-18 18:16 UTC (permalink / raw)


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(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 020302c..df7b84b 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -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)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] nvme: fabrics drivers don't need the nvme-pci driver
  2016-08-18 18:16 two small nvmf fixes for 4.8 Christoph Hellwig
  2016-08-18 18:16 ` [PATCH 1/2] nvme-fabrics: get a reference when reusing a nvme_host structure Christoph Hellwig
@ 2016-08-18 18:16 ` Christoph Hellwig
  2016-08-18 20:30 ` two small nvmf fixes for 4.8 J Freyensee
  2016-08-19 11:24 ` Sagi Grimberg
  3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-08-18 18:16 UTC (permalink / raw)


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(-)

diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig
index db39d53..0c644f7 100644
--- a/drivers/nvme/host/Kconfig
+++ b/drivers/nvme/host/Kconfig
@@ -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
diff --git a/drivers/nvme/target/Kconfig b/drivers/nvme/target/Kconfig
index a5c31cb..3a5b9d0 100644
--- a/drivers/nvme/target/Kconfig
+++ b/drivers/nvme/target/Kconfig
@@ -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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* two small nvmf fixes for 4.8
  2016-08-18 18:16 two small nvmf fixes for 4.8 Christoph Hellwig
  2016-08-18 18:16 ` [PATCH 1/2] nvme-fabrics: get a reference when reusing a nvme_host structure Christoph Hellwig
  2016-08-18 18:16 ` [PATCH 2/2] nvme: fabrics drivers don't need the nvme-pci driver Christoph Hellwig
@ 2016-08-18 20:30 ` J Freyensee
  2016-08-19 11:24 ` Sagi Grimberg
  3 siblings, 0 replies; 5+ messages in thread
From: J Freyensee @ 2016-08-18 20:30 UTC (permalink / raw)


On Thu, 2016-08-18@11:16 -0700, Christoph Hellwig wrote:
> 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>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* two small nvmf fixes for 4.8
  2016-08-18 18:16 two small nvmf fixes for 4.8 Christoph Hellwig
                   ` (2 preceding siblings ...)
  2016-08-18 20:30 ` two small nvmf fixes for 4.8 J Freyensee
@ 2016-08-19 11:24 ` Sagi Grimberg
  3 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2016-08-19 11:24 UTC (permalink / 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-19 11:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-18 18:16 two small nvmf fixes for 4.8 Christoph Hellwig
2016-08-18 18:16 ` [PATCH 1/2] nvme-fabrics: get a reference when reusing a nvme_host structure Christoph Hellwig
2016-08-18 18:16 ` [PATCH 2/2] nvme: fabrics drivers don't need the nvme-pci driver Christoph Hellwig
2016-08-18 20:30 ` two small nvmf fixes for 4.8 J Freyensee
2016-08-19 11:24 ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.