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]
Date:   Mon, 6 May 2019 10:34:47 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        stable <stable@...r.kernel.org>, Kangjie Lu <kjlu@....edu>,
        Jacek Anaszewski <jacek.anaszewski@...il.com>,
        "Sasha Levin (Microsoft)" <sashal@...nel.org>
Subject: Re: [PATCH 5.0 100/101] leds: pca9532: fix a potential NULL pointer
 dereference

On Mon, May 06, 2019 at 10:21:28AM +0200, Geert Uytterhoeven wrote:
> Hi Greg,
> 
> On Thu, May 2, 2019 at 5:34 PM Greg Kroah-Hartman
> <gregkh@...uxfoundation.org> wrote:
> > [ Upstream commit 0aab8e4df4702b31314a27ec4b0631dfad0fae0a ]
> >
> > In case of_match_device cannot find a match, return -EINVAL to avoid
> > NULL pointer dereference.
> >
> > Fixes: fa4191a609f2 ("leds: pca9532: Add device tree support")
> > Signed-off-by: Kangjie Lu <kjlu@....edu>
> > Signed-off-by: Jacek Anaszewski <jacek.anaszewski@...il.com>
> > Signed-off-by: Sasha Levin (Microsoft) <sashal@...nel.org>
> 
> > --- a/drivers/leds/leds-pca9532.c
> > +++ b/drivers/leds/leds-pca9532.c
> > @@ -513,6 +513,7 @@ static int pca9532_probe(struct i2c_client *client,
> >         const struct i2c_device_id *id)
> >  {
> >         int devid;
> > +       const struct of_device_id *of_id;
> >         struct pca9532_data *data = i2c_get_clientdata(client);
> >         struct pca9532_platform_data *pca9532_pdata =
> >                         dev_get_platdata(&client->dev);
> > @@ -528,8 +529,11 @@ static int pca9532_probe(struct i2c_client *client,
> >                         dev_err(&client->dev, "no platform data\n");
> >                         return -EINVAL;
> >                 }
> > -               devid = (int)(uintptr_t)of_match_device(
> > -                       of_pca9532_leds_match, &client->dev)->data;
> > +               of_id = of_match_device(of_pca9532_leds_match,
> > +                               &client->dev);
> > +               if (unlikely(!of_id))
> 
> This condition (1) can never be true, as of_pca9532_leds_match[]
> populates the .data field of all entries, and (2) is already checked for
> in pca9532_of_populate_pdata(), so pca9532_probe() would already
> have aborted with -ENODEV before.
> 
> https://lore.kernel.org/lkml/CAMuHMdXELu2tcSB5C1yKUGft6sDGPAy997ApPzy17n0MssfyWA@mail.gmail.com/
> 
> So please stop backporting this to even more stable trees.
> Thanks!

It's already merged in a bunch of stable trees, so let's just leave it
as-is :)

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ