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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADBw62p=aB3EZYkMm44Zx4Krww21SS9vCsMnPOq0pn2DgA8VkQ@mail.gmail.com>
Date:   Sat, 1 Aug 2020 07:58:56 +0800
From:   Baolin Wang <baolin.wang7@...il.com>
To:     Chunyan Zhang <zhang.lyra@...il.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        linux-gpio@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        Orson Zhai <orsonzhai@...il.com>,
        Chunyan Zhang <chunyan.zhang@...soc.com>,
        Taiping Lai <taiping.lai@...soc.com>
Subject: Re: [PATCH] gpio: sprd: Clear interrupt when setting the type as edge

On Wed, Jul 29, 2020 at 5:35 PM Chunyan Zhang <zhang.lyra@...il.com> wrote:
>
> From: Taiping Lai <taiping.lai@...soc.com>
>
> The raw interrupt status of GPIO maybe set before the interrupt is enabled,
> which would trigger the interrupt event once enabled it from user side.
> This is the case for edge interrupts only. Adding a clear operation when
> setting interrupt type can avoid that.
>
> Fixes: 9a3821c2bb47 ("gpio: Add GPIO driver for Spreadtrum SC9860 platform")
> Signed-off-by: Taiping Lai <taiping.lai@...soc.com>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@...soc.com>
> ---
>  drivers/gpio/gpio-sprd.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpio/gpio-sprd.c b/drivers/gpio/gpio-sprd.c
> index d7314d39ab65..36ea8a3bd451 100644
> --- a/drivers/gpio/gpio-sprd.c
> +++ b/drivers/gpio/gpio-sprd.c
> @@ -149,17 +149,20 @@ static int sprd_gpio_irq_set_type(struct irq_data *data,
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 1);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1);

I think you should move this abonormal interrupt clearing operation to
sprd_gpio_request(), when users request a GPIO.

>                 irq_set_handler_locked(data, handle_edge_irq);
>                 break;
>         case IRQ_TYPE_EDGE_FALLING:
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1);
>                 irq_set_handler_locked(data, handle_edge_irq);
>                 break;
>         case IRQ_TYPE_EDGE_BOTH:
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
>                 sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 1);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1);
>                 irq_set_handler_locked(data, handle_edge_irq);
>                 break;
>         case IRQ_TYPE_LEVEL_HIGH:
> --
> 2.20.1
>


-- 
Baolin Wang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ