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: <CAMRc=Mfw09z2vnsQXmbc_xrg5xrLv4y1myCdm1zrx8GBWMWTzg@mail.gmail.com>
Date:   Tue, 22 Aug 2023 14:38:28 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Kent Gibson <warthog618@...il.com>, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH 1/2] gpio: sim: dispose of irq mappings before destroying
 the irq_sim domain

On Tue, Aug 22, 2023 at 2:24 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Tue, Aug 22, 2023 at 02:16:44PM +0200, Bartosz Golaszewski wrote:
> > On Tue, Aug 22, 2023 at 2:12 PM Andy Shevchenko
> > <andriy.shevchenko@...ux.intel.com> wrote:
> > > On Tue, Aug 22, 2023 at 09:51:21AM +0200, Bartosz Golaszewski wrote:
>
> ...
>
> > > > +static void gpio_sim_dispose_mappings(void *data)
> > > > +{
> > > > +     struct gpio_sim_chip *chip = data;
> > > > +     unsigned int i, irq;
> > > > +
> > > > +     for (i = 0; i < chip->gc.ngpio; i++) {
> > > > +             irq = irq_find_mapping(chip->irq_sim, i);
> > >
> > > > +             if (irq)
> > >
> > > This duplicates check in the following call.
> > >
> >
> > Ah so it can be a direct call:
> >
> >     irq_dispose_mapping(irq_find_mapping(chip->irq_sim, i));
> >
> > ?
>
> Hehe, seems yes and no. According to the code — yes, but code seems buggy,
> and compiler may effectively drop the check (haven't checked this, though).
>
> OTOH, the problem may appear if and only if we have no sparse IRQ configuration
> which is probably rare.
>
> That said, I will go without check, it's not your issue.
> And I found other places in IRQ framework that misses that check.
>

I disagree. If there's no strong contract from the provider of this
function then this check is so cheap that I'm ready to live with it.

Bart

> > > > +                     irq_dispose_mapping(irq);
> > > > +     }
> > > > +}
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ