Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] nvme-rdma: fix a segmentation fault during module unload
@ 2019-10-29 14:42 Max Gurtovoy
  2019-10-29 17:14 ` Sagi Grimberg
  0 siblings, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2019-10-29 14:42 UTC (permalink / raw)
  To: linux-nvme, kbusch, hch, sagi; +Cc: Max Gurtovoy, shlomin, israelr

In case there are controllers that are not associated with any RDMA
device (e.g. during unsuccessful reconnection) and the user will unload
the module, these controllers will not be freed and will access already
freed memory. The same logic appears in other fabric drivers as well.

Fixes: 87fd125344d6 ("nvme-rdma: remove redundant reference between ib_device and tagset")
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
---
 drivers/nvme/host/rdma.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index f19a28b..cb4c300 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -2133,8 +2133,16 @@ static int __init nvme_rdma_init_module(void)
 
 static void __exit nvme_rdma_cleanup_module(void)
 {
+	struct nvme_rdma_ctrl *ctrl;
+
 	nvmf_unregister_transport(&nvme_rdma_transport);
 	ib_unregister_client(&nvme_rdma_ib_client);
+
+	mutex_lock(&nvme_rdma_ctrl_mutex);
+	list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list)
+		nvme_delete_ctrl(&ctrl->ctrl);
+	mutex_unlock(&nvme_rdma_ctrl_mutex);
+	flush_workqueue(nvme_delete_wq);
 }
 
 module_init(nvme_rdma_init_module);
-- 
1.8.3.1


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

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

* Re: [PATCH 1/1] nvme-rdma: fix a segmentation fault during module unload
  2019-10-29 14:42 [PATCH 1/1] nvme-rdma: fix a segmentation fault during module unload Max Gurtovoy
@ 2019-10-29 17:14 ` Sagi Grimberg
  2019-10-30  0:46   ` Keith Busch
  0 siblings, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2019-10-29 17:14 UTC (permalink / raw)
  To: Max Gurtovoy, linux-nvme, kbusch, hch; +Cc: shlomin, israelr

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

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

* Re: [PATCH 1/1] nvme-rdma: fix a segmentation fault during module unload
  2019-10-29 17:14 ` Sagi Grimberg
@ 2019-10-30  0:46   ` Keith Busch
  2019-10-30  2:20     ` Keith Busch
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Busch @ 2019-10-30  0:46 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Max Gurtovoy, israelr, hch, linux-nvme, shlomin

Thanks, applied to nvme-5.5.

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

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

* Re: [PATCH 1/1] nvme-rdma: fix a segmentation fault during module unload
  2019-10-30  0:46   ` Keith Busch
@ 2019-10-30  2:20     ` Keith Busch
  2019-10-30  8:44       ` Max Gurtovoy
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Busch @ 2019-10-30  2:20 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: shlomin, Max Gurtovoy, hch, linux-nvme, israelr

On Wed, Oct 30, 2019 at 09:46:43AM +0900, Keith Busch wrote:
> Thanks, applied to nvme-5.5.

Oops, this one is a fixes, so I've put this patch in 5.4, and the other
in 5.5.

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

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

* Re: [PATCH 1/1] nvme-rdma: fix a segmentation fault during module unload
  2019-10-30  2:20     ` Keith Busch
@ 2019-10-30  8:44       ` Max Gurtovoy
  0 siblings, 0 replies; 5+ messages in thread
From: Max Gurtovoy @ 2019-10-30  8:44 UTC (permalink / raw)
  To: Keith Busch, Sagi Grimberg; +Cc: israelr, hch, linux-nvme, shlomin


On 10/30/2019 4:20 AM, Keith Busch wrote:
> On Wed, Oct 30, 2019 at 09:46:43AM +0900, Keith Busch wrote:
>> Thanks, applied to nvme-5.5.
> Oops, this one is a fixes, so I've put this patch in 5.4, and the other
> in 5.5.

thanks.

which other one ?


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

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 14:42 [PATCH 1/1] nvme-rdma: fix a segmentation fault during module unload Max Gurtovoy
2019-10-29 17:14 ` Sagi Grimberg
2019-10-30  0:46   ` Keith Busch
2019-10-30  2:20     ` Keith Busch
2019-10-30  8:44       ` Max Gurtovoy

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git