From: Alex Williamson <alex.williamson@redhat.com>
To: stable@vger.kernel.org
Cc: Alex Williamson <alex.williamson@redhat.com>,
sashal@kernel.org, gregkh@linuxfoundation.org,
eric.auger@redhat.com, Diana Craciun <diana.craciun@oss.nxp.com>,
Kevin Tian <kevin.tian@intel.com>
Subject: [PATCH 6.1.y 7/7] vfio/fsl-mc: Block calling interrupt handler without trigger
Date: Fri, 29 Mar 2024 15:38:54 -0600 [thread overview]
Message-ID: <20240329213856.2550762-8-alex.williamson@redhat.com> (raw)
In-Reply-To: <20240329213856.2550762-1-alex.williamson@redhat.com>
[ Upstream commit 7447d911af699a15f8d050dfcb7c680a86f87012 ]
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: cc0ee20bd969 ("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>
---
drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c
index 7b428eac3d3e..b125b6edf634 100644
--- a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c
+++ b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c
@@ -142,13 +142,14 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev,
irq = &vdev->mc_irqs[index];
if (flags & VFIO_IRQ_SET_DATA_NONE) {
- vfio_fsl_mc_irq_handler(hwirq, irq);
+ if (irq->trigger)
+ eventfd_signal(irq->trigger, 1);
} else if (flags & VFIO_IRQ_SET_DATA_BOOL) {
u8 trigger = *(u8 *)data;
- if (trigger)
- vfio_fsl_mc_irq_handler(hwirq, irq);
+ if (trigger && irq->trigger)
+ eventfd_signal(irq->trigger, 1);
}
return 0;
--
2.44.0
next prev parent reply other threads:[~2024-03-29 21:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-29 21:38 [PATCH 6.1.y 0/7] vfio: Interrupt eventfd hardening for 6.6.y Alex Williamson
2024-03-29 21:38 ` [PATCH 6.1.y 1/7] Revert "vfio/pci: Disable auto-enable of exclusive INTx IRQ" Alex Williamson
2024-03-30 8:46 ` Greg KH
2024-03-29 21:38 ` [PATCH 6.1.y 2/7] Revert "vfio/pci: Prepare for dynamic interrupt context storage" Alex Williamson
2024-03-30 8:46 ` Greg KH
2024-03-29 21:38 ` [PATCH 6.1.y 3/7] vfio/pci: Disable auto-enable of exclusive INTx IRQ Alex Williamson
2024-03-29 21:38 ` [PATCH 6.1.y 4/7] vfio: Introduce interface to flush virqfd inject workqueue Alex Williamson
2024-03-29 21:38 ` [PATCH 6.1.y 5/7] vfio/pci: Create persistent INTx handler Alex Williamson
2024-03-29 21:38 ` [PATCH 6.1.y 6/7] vfio/platform: Create persistent IRQ handlers Alex Williamson
2024-03-29 21:38 ` Alex Williamson [this message]
2024-03-30 8:54 ` [PATCH 6.1.y 0/7] vfio: Interrupt eventfd hardening for 6.6.y Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240329213856.2550762-8-alex.williamson@redhat.com \
--to=alex.williamson@redhat.com \
--cc=diana.craciun@oss.nxp.com \
--cc=eric.auger@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=kevin.tian@intel.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox