Skip to content

Commit 82b951e

Browse files
Ye Binawilliam
authored andcommitted
vfio/pci: fix potential memory leak in vfio_intx_enable()
If vfio_irq_ctx_alloc() failed will lead to 'name' memory leak. Fixes: 18c198c ("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]>
1 parent d530531 commit 82b951e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/vfio/pci/vfio_pci_intrs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,
267267
return -ENOMEM;
268268

269269
ctx = vfio_irq_ctx_alloc(vdev, 0);
270-
if (!ctx)
270+
if (!ctx) {
271+
kfree(name);
271272
return -ENOMEM;
273+
}
272274

273275
ctx->name = name;
274276
ctx->trigger = trigger;

0 commit comments

Comments
 (0)