lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sun, 1 Nov 2015 17:11:43 +0530
From:	pawandeep oza <oza.contri.linux.kernel@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] manage/irq.c <misleading WARNING: Trying to free already-free IRQ>

Hello,

there is this WARNING coming "Trying to free already-free IRQ"
but that warning suggests that we are either calling free_irq twice
or
request_irq has not been made.


bu the problem was, free_irq was being called with invalid/NULL device id.
but the warning is misleading which does not hint to the invalid/NULL device id.

and this is not a shared interrupt, should not be some "meaningful
warning to be given"  ??
also why to iterate through the list if it is not shared ?

patch below to address this.

(though I am still thinking if this is an optimal/good way to address it)
or even there is a need to address !

------------------------------------------------------------------------------
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3dc6a61..87a3ea0 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1305,6 +1305,7 @@ static struct irqaction *__free_irq(unsigned int
irq, void *dev_id)
        struct irq_desc *desc = irq_to_desc(irq);
        struct irqaction *action, **action_ptr;
        unsigned long flags;
+       bool shared = false;

        WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq);

@@ -1322,15 +1323,34 @@ static struct irqaction *__free_irq(unsigned
int irq, void *dev_id)
                action = *action_ptr;

                if (!action) {
-                       WARN(1, "Trying to free already-free IRQ %d\n", irq);
+                       if (!shared) {
+                               WARN(1, "Trying to free already-free
IRQ %d\n", irq);
+                               raw_spin_unlock_irqrestore(&desc->lock, flags);
+
+                               return NULL;
+                       }
+                       else {
+                               WARN(1, "irq mismatch with device %d\n", irq);
+                               raw_spin_unlock_irqrestore(&desc->lock, flags);
+
+                               return NULL;
+                       }
+               }
+
+               if (action->dev_id == dev_id)
+                       break;
+
+               if (action->flags & IRQF_SHARED) {
+                       action_ptr = &action->next;
+                       shared = true;
+               }
+               else {
+                       WARN(1, "irq mismatch with device %d\n", irq);
                        raw_spin_unlock_irqrestore(&desc->lock, flags);

                        return NULL;
                }

-               if (action->dev_id == dev_id)
-                       break;
-               action_ptr = &action->next;
        }

        /* Found it - now remove it from the list of entries: */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists