Skip to contentSkip to conversation

ibmvfc: free channel_setup_buf during device tear down

PATCH Applied Tyrel Datwyler 2 participants 2 messages Mar 11, 2021 – Mar 16, 2021

Subsystems (3)
lore
Share & tools
lore

Tyrel Datwyler

author maintainer
#0 lore raw

PATCH 1/1 ibmvfc: free channel_setup_buf during device tear down

The buffer for negotiating channel setup is DMA allocated at device probe time. However, the remove path fails to free this allocation which will prevent the hypervisor from releasing the virtual device in the case of a hotplug remove.

Fix this issue by freeing the buffer allocation in ibmvfc_free_mem().

Fixes e95eef3fc0bc ("scsi: ibmvfc: Implement channel enquiry and setup commands")
---
 drivers/scsi/ibmvscsi/ibmvfc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/ibmvscsi/ibmvfc.c +2 -0
index e663085a8944..76531eec49de 100644
@@ -5770,6 +5770,8 @@ static void ibmvfc_free_mem(struct ibmvfc_host *vhost)
 			  vhost->disc_buf_dma);
 	dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf),
 			  vhost->login_buf, vhost->login_buf_dma);
+	dma_free_coherent(vhost->dev, sizeof(*vhost->channel_setup_buf),
+			  vhost->channel_setup_buf, vhost->channel_setup_dma);
 	dma_pool_destroy(vhost->sg_pool);
 	ibmvfc_free_queue(vhost, async_q);
 	LEAVE;
Signature · 1 line
2.27.0
#1 lore raw
Quoted 6 lines · Tyrel Datwyler

The buffer for negotiating channel setup is DMA allocated at device probe time. However, the remove path fails to free this allocation which will prevent the hypervisor from releasing the virtual device in the case of a hotplug remove.

Fix this issue by freeing the buffer allocation in ibmvfc_free_mem().

Applied to 5.12/scsi-fixes, thanks!

[1/1] ibmvfc: free channel_setup_buf during device tear down

      https://git.kernel.org/mkp/scsi/c/febb0cc847e7
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering