Skip to content

Commit 7447d91

Browse files
committed
vfio/fsl-mc: Block calling interrupt handler without trigger
The eventfd_ctx trigger pointer of the vfio_fsl_mc_irq object is initially NULL and may become NULL if the user sets the trigger eventfd to -1. The interrupt handler itself is guaranteed that trigger is always valid between request_irq() and free_irq(), but the loopback testing mechanisms to invoke the handler function need to test the trigger. The triggering and setting ioctl paths both make use of igate and are therefore mutually exclusive. The vfio-fsl-mc driver does not make use of irqfds, nor does it support any sort of masking operations, therefore unlike vfio-pci and vfio-platform, the flow can remain essentially unchanged. Cc: Diana Craciun <diana.craciun@oss.nxp.com> Cc: <stable@vger.kernel.org> Fixes: cc0ee20 ("vfio/fsl-mc: trigger an interrupt via eventfd") Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Link: https://lore.kernel.org/r/20240308230557.805580-8-alex.williamson@redhat.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 675daf4 commit 7447d91

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev,
141141
irq = &vdev->mc_irqs[index];
142142

143143
if (flags & VFIO_IRQ_SET_DATA_NONE) {
144-
vfio_fsl_mc_irq_handler(hwirq, irq);
144+
if (irq->trigger)
145+
eventfd_signal(irq->trigger);
145146

146147
} else if (flags & VFIO_IRQ_SET_DATA_BOOL) {
147148
u8 trigger = *(u8 *)data;
148149

149-
if (trigger)
150-
vfio_fsl_mc_irq_handler(hwirq, irq);
150+
if (trigger && irq->trigger)
151+
eventfd_signal(irq->trigger);
151152
}
152153

153154
return 0;

0 commit comments

Comments
 (0)