Patch "xen/evtchn: avoid WARN() when unbinding an event channel" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    xen/evtchn: avoid WARN() when unbinding an event channel

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xen-evtchn-avoid-warn-when-unbinding-an-event-channe.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 244b0a107e33ac2e71a3c6e390668718812b671c
Author: Juergen Gross <jgross@xxxxxxxx>
Date:   Wed Mar 13 08:14:08 2024 +0100

    xen/evtchn: avoid WARN() when unbinding an event channel
    
    [ Upstream commit 51c23bd691c0f1fb95b29731c356c6fd69925d17 ]
    
    When unbinding a user event channel, the related handler might be
    called a last time in case the kernel was built with
    CONFIG_DEBUG_SHIRQ. This might cause a WARN() in the handler.
    
    Avoid that by adding an "unbinding" flag to struct user_event which
    will short circuit the handler.
    
    Fixes: 9e90e58c11b7 ("xen: evtchn: Allow shared registration of IRQ handers")
    Reported-by: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
    Tested-by: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
    Link: https://lore.kernel.org/r/20240313071409.25913-2-jgross@xxxxxxxx
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index 59717628ca42b..f6a2216c2c870 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -85,6 +85,7 @@ struct user_evtchn {
 	struct per_user_data *user;
 	evtchn_port_t port;
 	bool enabled;
+	bool unbinding;
 };
 
 static void evtchn_free_ring(evtchn_port_t *ring)
@@ -164,6 +165,10 @@ static irqreturn_t evtchn_interrupt(int irq, void *data)
 	struct per_user_data *u = evtchn->user;
 	unsigned int prod, cons;
 
+	/* Handler might be called when tearing down the IRQ. */
+	if (evtchn->unbinding)
+		return IRQ_HANDLED;
+
 	WARN(!evtchn->enabled,
 	     "Interrupt for port %u, but apparently not enabled; per-user %p\n",
 	     evtchn->port, u);
@@ -421,6 +426,7 @@ static void evtchn_unbind_from_user(struct per_user_data *u,
 
 	BUG_ON(irq < 0);
 
+	evtchn->unbinding = true;
 	unbind_from_irqhandler(irq, evtchn);
 
 	del_evtchn(u, evtchn);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux