[PATCH 10/13] VMCI: Release notification_bitmap in error path

Tim Gardner tim.gardner at canonical.com
Tue Jun 14 19:06:15 UTC 2022


From: Vishnu Dasa <vdasa at vmware.com>

BugLink: https://bugs.launchpad.net/bugs/1978145

notification_bitmap may not be released when VMCI_CAPS_DMA_DATAGRAM
capability is missing from the device.  Add missing
'err_free_notification_bitmap' label and use it instead of
'err_free_data_buffers' to avoid this.

Fixes: eed2298d9360 ("VMCI: dma dg: detect DMA datagram capability")
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Reviewed-by: Bryan Tan <bryantan at vmware.com>
Reviewed-by: Rajesh Jalisatgi <rjalisatgi at vmware.com>
Signed-off-by: Vishnu Dasa <vdasa at vmware.com>
Link: https://lore.kernel.org/r/20220318060040.31621-1-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit c8e9b30ccae605bf1dbeaf03971f9b83f70b928d)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
 drivers/misc/vmw_vmci/vmci_guest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
index 6e072728c4e0..3fcbf07517ae 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -722,7 +722,7 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
 			dev_err(&pdev->dev,
 				"Missing capability: VMCI_CAPS_DMA_DATAGRAM\n");
 			error = -ENXIO;
-			goto err_free_data_buffers;
+			goto err_free_notification_bitmap;
 		}
 	}
 
@@ -886,6 +886,7 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
 	vmci_dev_g = NULL;
 	spin_unlock_irq(&vmci_dev_spinlock);
 
+err_free_notification_bitmap:
 	if (vmci_dev->notification_bitmap) {
 		vmci_write_reg(vmci_dev, VMCI_CONTROL_RESET, VMCI_CONTROL_ADDR);
 		dma_free_coherent(&pdev->dev, PAGE_SIZE,
-- 
2.36.1




More information about the kernel-team mailing list