linux-mips
[Top] [All Lists]

[PATCH] MIPS: Fix gic_set_affinity infinite loop

To: ralf@linux-mips.org, Steven.Hill@imgtec.com, linux-mips@linux-mips.org
Subject: [PATCH] MIPS: Fix gic_set_affinity infinite loop
From: Tony Wu <tung7970@gmail.com>
Date: Fri, 21 Jun 2013 19:13:08 +0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=q8mYNbUZg0JP5Zim7LzXhREyuqz93kAU8F/gbI+6wIE=; b=pcUEHnXijdL2FIs//S9cRgP7RtESiIVJBeh+44S/+89lJfg2qkWUPcEPJDoUDwfEFR cl5Vq6cCH39YD68JxoGY8Zso++8OXHuu+UTWHtDSCBabmSaJolEyX25K9rXK1u7ZObDI zaJa4cvP/Gc5cYGzY0XefQvwuVHZKE/YU7/K0r6rRXH8AVZAK1i1jePORwbGbVbBBJJS 3aT5pSeSwEh9GCKOPr8jrDR7rNCkAul+ShKjydcJ1rsTfWwE3PwYe/wRUxGkKjsrDFXb 1hrhncu4hWwIB9ikwqXX+IBLsHzw5DbQGfy4pDQjpbVSe7ta3lvkURyEWpd5pjy2LtjE oHfQ==
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
There is an infinite loop in gic_set_affinity. When irq_set_affinity
gets called on gic controller, it blocks forever.

Signed-off-by: Tony Wu <tung7970@gmail.com>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
---
 arch/mips/kernel/irq-gic.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index c01b307..5b5ddb2 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -219,16 +219,15 @@ static int gic_set_affinity(struct irq_data *d, const 
struct cpumask *cpumask,
 
        /* Assumption : cpumask refers to a single CPU */
        spin_lock_irqsave(&gic_lock, flags);
-       for (;;) {
-               /* Re-route this IRQ */
-               GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
 
-               /* Update the pcpu_masks */
-               for (i = 0; i < NR_CPUS; i++)
-                       clear_bit(irq, pcpu_masks[i].pcpu_mask);
-               set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
+       /* Re-route this IRQ */
+       GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
+
+       /* Update the pcpu_masks */
+       for (i = 0; i < NR_CPUS; i++)
+               clear_bit(irq, pcpu_masks[i].pcpu_mask);
+       set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
 
-       }
        cpumask_copy(d->affinity, cpumask);
        spin_unlock_irqrestore(&gic_lock, flags);
 
-- 
1.7.10.2

<Prev in Thread] Current Thread [Next in Thread>