public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Subject: Re: [PATCH v1 1/1] mfd: Remove software node conditionally and locate at right place
Date: Wed, 19 May 2021 13:03:02 +0100	[thread overview]
Message-ID: <20210519120302.GH2403908@dell> (raw)
In-Reply-To: <20210510141552.57045-1-andriy.shevchenko@linux.intel.com>

On Mon, 10 May 2021, Andy Shevchenko wrote:

> Currently the software node is removed in error case and at ->remove()
> stage unconditionally, that ruins the symmetry. Besides, in some cases,
> when mfd_add_device() fails, the device_remove_software_node() call
> may lead to NULL pointer dereference:
> 
>   BUG: kernel NULL pointer dereference, address: 00000000
>   ...
>   EIP: strlen+0x12/0x20
>   ...
>   kernfs_name_hash+0x13/0x70
>   kernfs_find_ns+0x32/0xc0
>   kernfs_remove_by_name_ns+0x2a/0x90
>   sysfs_remove_link+0x16/0x30
>   software_node_notify.cold+0x34/0x6b
>   device_remove_software_node+0x5a/0x90
>   mfd_add_device.cold+0x30a/0x427
> 
> Fix all these by guarding device_remove_software_node() with a conditional
> and locating it at the right place.
> 
> Fixes: 42e59982917a ("mfd: core: Add support for software nodes")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/mfd/mfd-core.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

      reply	other threads:[~2021-05-19 12:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 14:15 [PATCH v1 1/1] mfd: Remove software node conditionally and locate at right place Andy Shevchenko
2021-05-19 12:03 ` Lee Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210519120302.GH2403908@dell \
    --to=lee.jones@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox