diff options
author | Ye Bin <[email protected]> | 2024-04-15 09:50:29 +0800 |
---|---|---|
committer | Alex Williamson <[email protected]> | 2024-04-22 16:52:08 -0600 |
commit | 82b951e6fbd31d85ae7f4feb5f00ddd4c5d256e2 (patch) | |
tree | 2314cc8cbca4ef7035fcb05f8cfb92fdf5ef9c73 | |
parent | d530531936482f97b7b3784793d3514185b820d4 (diff) |
vfio/pci: fix potential memory leak in vfio_intx_enable()
If vfio_irq_ctx_alloc() failed will lead to 'name' memory leak.
Fixes: 18c198c96a81 ("vfio/pci: Create persistent INTx handler")
Signed-off-by: Ye Bin <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Acked-by: Reinette Chatre <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>
-rw-r--r-- | drivers/vfio/pci/vfio_pci_intrs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index d52825a096ad..8382c5834335 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -267,8 +267,10 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev, return -ENOMEM; ctx = vfio_irq_ctx_alloc(vdev, 0); - if (!ctx) + if (!ctx) { + kfree(name); return -ENOMEM; + } ctx->name = name; ctx->trigger = trigger; |