From: Maxim Levitsky <mlevitsk@redhat.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] device property: Avoid NULL pointer dereference in device_get_next_child_node()
Date: Fri, 17 Jul 2020 17:05:25 +0300 [thread overview]
Message-ID: <681fa44e57531c81bef628f8a16a14098abdf2c2.camel@redhat.com> (raw)
In-Reply-To: <20200716182747.54929-1-andriy.shevchenko@linux.intel.com>
On Thu, 2020-07-16 at 21:27 +0300, Andy Shevchenko wrote:
> When we have no primary fwnode or when it's a software node, we may end up
> in the situation when fwnode is a NULL pointer. There is no point to look for
> secondary fwnode in such case. Add a necessary check to a condition.
>
> Fixes: 114dbb4fa7c4 ("drivers property: When no children in primary, try secondary")
> Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Maxim Levitsky <mlevitsk@redhat.com>
Best regards,
Maxim Levitsky
> ---
> drivers/base/property.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 1e6d75e65938..d58aa98fe964 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -721,7 +721,7 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,
> return next;
>
> /* When no more children in primary, continue with secondary */
> - if (!IS_ERR_OR_NULL(fwnode->secondary))
> + if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary))
> next = fwnode_get_next_child_node(fwnode->secondary, child);
>
> return next;
prev parent reply other threads:[~2020-07-17 14:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 18:27 [PATCH v1] device property: Avoid NULL pointer dereference in device_get_next_child_node() Andy Shevchenko
2020-07-17 14:05 ` Maxim Levitsky [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=681fa44e57531c81bef628f8a16a14098abdf2c2.camel@redhat.com \
--to=mlevitsk@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@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;
as well as URLs for NNTP newsgroup(s).