Re: [PATCH v2] serial: sh-sci: Do not free irqs that have already been freed

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

 



Hi Chris,

On Mon, Jan 28, 2019 at 7:26 PM Chris Brandt <chris.brandt@xxxxxxxxxxx> wrote:
> Since IRQs might be muxed on some parts, we need to pay attention when we
> are freeing them.
> Otherwise we get the ugly WARNING "Trying to free already-free IRQ 20".
>
> Fixes: 628c534ae735 ("serial: sh-sci: Improve support for separate TEI and DRI interrupts")
> Signed-off-by: Chris Brandt <chris.brandt@xxxxxxxxxxx>
> ---
> v2:

Thanks for the update!

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c

> @@ -1952,6 +1952,13 @@ static void sci_free_irq(struct sci_port *port)
>                 if (unlikely(irq < 0))
>                         continue;
>
> +               /* Check if already freed (irq was muxed) */
> +               for (j = 0; j < i; j++)
> +                       if (port->irqs[j] == irq)
> +                               j = i + 1;
> +               if (j > i)
> +                       continue;
> +
>                 free_irq(port->irqs[i], port);
>                 kfree(port->irqstr[i]);

I think the error path in sci_request_irq() needs similar handling, also for
SCIx_IRQ_IS_MUXED().

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux