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]
Date:   Mon, 13 Feb 2023 08:12:08 +0100
From:   Alexander Sverdlin <alexander.sverdlin@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH] driver: core: Prevent NULL pointer dereference in
 device name functions

Hi Greg,

On Mon, 2023-02-13 at 08:07 +0100, Greg Kroah-Hartman wrote:
> > Prevent similar scenarios:
> > 
> > Unable to handle kernel NULL pointer dereference at virtual address 00000038
> > ...
> > PC is at dev_driver_string+0x0/0x38
> 
> How did this "scenario" happen?  What in-tree code caused this?
> 

such in-tree code is not known to me, I stubled upon this putting dev_info()
all over the code in the platform we currently convert to DT (cirrus ep93xx).

> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@...il.com>
> > ---
> >   drivers/base/core.c    | 3 +++
> >   include/linux/device.h | 5 +++++
> >   2 files changed, 8 insertions(+)
> > 
> > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > index a3e14143ec0c..4ff2ddea7c9b 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -2174,6 +2174,9 @@ const char *dev_driver_string(const struct device *dev)
> >   {
> >         struct device_driver *drv;
> >   
> > +       if (!dev)
> > +               return "<null>";
> > +
> 
> None of these functions should be called with a NULL pointer as the
> reference should have been properly gotten on them before calling these
> functions.  So let's fix up the callers please, something is really
> wrong with them.  Again, what in-tree code is causing this to happen?

Thanks for the explanation!

-- 
Alexander Sverdlin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ