]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] sir_ir: infinite loop in interrupt handler
authorSean Young <sean@mess.org>
Tue, 16 May 2017 07:56:14 +0000 (04:56 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 18 May 2017 09:16:41 +0000 (06:16 -0300)
Since this driver does no detection of hardware, it might be used with
a non-sir port. Escape out if we are spinning.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/sir_ir.c

index e12ec50bf0bf7531cb76ef129149d77f531fa525..90a5f8fd5eea68d6e1f007843c6bb67f7c8790b2 100644 (file)
@@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id)
        static unsigned long delt;
        unsigned long deltintr;
        unsigned long flags;
+       int counter = 0;
        int iir, lsr;
 
        while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) {
+               if (++counter > 256) {
+                       dev_err(&sir_ir_dev->dev, "Trapped in interrupt");
+                       break;
+               }
+
                switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */
                case UART_IIR_MSI:
                        (void)inb(io + UART_MSR);