Skip to content

Commit

Permalink
VMCI: Release notification_bitmap in error path
Browse files Browse the repository at this point in the history
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: eed2298 ("VMCI: dma dg: detect DMA datagram capability")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Bryan Tan <bryantan@vmware.com>
Reviewed-by: Rajesh Jalisatgi <rjalisatgi@vmware.com>
Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Link: https://lore.kernel.org/r/20220318060040.31621-1-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Vishnu Dasa authored and Greg Kroah-Hartman committed Mar 18, 2022
1 parent 5df0e73 commit c8e9b30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/misc/vmw_vmci/vmci_guest.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,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;
}
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c8e9b30

Please sign in to comment.