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] [day] [month] [year] [list]
Message-ID: <20240322115754.GA45839@rigel>
Date: Fri, 22 Mar 2024 19:57:54 +0800
From: Kent Gibson <warthog618@...il.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org, Alexey Dobriyan <adobriyan@...il.com>,
	stable@...r.kernel.org, Stefan Wahren <wahrenst@....net>,
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v2] gpio: cdev: sanitize the label before requesting the
 interrupt

On Fri, Mar 22, 2024 at 12:52:29PM +0100, Bartosz Golaszewski wrote:
> On Fri, Mar 22, 2024 at 12:18 PM Kent Gibson <warthog618@...il.com> wrote:
> >
> > On Fri, Mar 22, 2024 at 10:02:08AM +0100, Bartosz Golaszewski wrote:
> > > From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> > >
> > > @@ -2198,12 +2216,18 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
> > >       if (ret)
> > >               goto out_free_le;
> > >
> > > +     label = make_irq_label(le->label);
> > > +     if (!label) {
> > > +             ret = -ENOMEM;
> > > +             goto out_free_le;
> > > +     }
> > > +
> > >       /* Request a thread to read the events */
> > >       ret = request_threaded_irq(irq,
> > >                                  lineevent_irq_handler,
> > >                                  lineevent_irq_thread,
> > >                                  irqflags,
> > > -                                le->label,
> > > +                                label,
> > >                                  le);
> > >       if (ret)
> > >               goto out_free_le;
> >
> > Leaks label if the request_threaded_irq() fails.
> >
>
> Ah, dammit, I didn't catch the fact that irq_free() will not return
> the label address if the request failed.
>

You caught it in edge_detector_setup() - you call free_irq_label() if
request_threaded_irq() fails there.

> Nice catch.

The give away here is that the goto targets are the same.
Bit irritated that I didn't catch it earlier - got distracted by the
return code problem.

Anyway, third time lucky.

Cheers,
Kent.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ