From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Daniil Lunev <dlunev@chromium.org>, LKML <linux-kernel@vger.kernel.org>
Cc: Prashant Malani <pmalani@chromium.org>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>
Subject: Re: [PATCH] platform/chrome: cros_ec_typec: Handle NULL EC pointer during probe.
Date: Wed, 29 Apr 2020 23:58:02 +0200 [thread overview]
Message-ID: <c57b0892-d68d-f0f2-3cc1-b8549983227e@collabora.com> (raw)
In-Reply-To: <20200428110253.1.I926f6741079cafb04ecb592130aef75b24ad31ae@changeid>
Hi Daniil,
Thank you for the patch.
On 28/4/20 3:02, Daniil Lunev wrote:
> Missing EC in device hierarchy causes NULL pointer to be returned to the
> probe function which leads to NULL pointer dereference when trying to
> send a command to the EC. This can be the case if the device is missing
> or incorrectly configured in the firmware blob. Even if the situation
There is any production device with a buggy firmware outside? Or this is just
for defensive programming while developing the firmware? Which device is
affected for this issue?
Thanks,
Enric
> occures, the driver shall not cause a kernel panic as the condition is
> not critical for the system functions.
>
> Signed-off-by: Daniil Lunev <dlunev@chromium.org>
> ---
>
> drivers/platform/chrome/cros_ec_typec.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 874269c07073..30d99c930445 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -301,6 +301,11 @@ static int cros_typec_probe(struct platform_device *pdev)
>
> typec->dev = dev;
> typec->ec = dev_get_drvdata(pdev->dev.parent);
> + if (!typec->ec) {
> + dev_err(dev, "Failed to get Cros EC data\n");
> + return -EINVAL;
> + }
> +
> platform_set_drvdata(pdev, typec);
>
> ret = cros_typec_get_cmd_version(typec);
>
next prev parent reply other threads:[~2020-04-29 21:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 1:02 Daniil Lunev
2020-04-29 21:58 ` Enric Balletbo i Serra [this message]
[not found] ` <CAONX=-dLVBpz+p1si4cWGHEmQ_toO8kW=fCPcdUuX2KLc-o=2A@mail.gmail.com>
2020-04-30 0:38 ` Daniil Lunev
2020-04-30 0:43 ` Prashant Malani
2020-04-30 15:26 ` Enric Balletbo i Serra
2020-04-30 16:17 ` Prashant Malani
2020-05-01 0:15 ` Daniil Lunev
2020-05-01 0:56 ` Prashant Malani
2020-05-01 3:22 ` Daniil Lunev
2020-05-05 20:36 ` Enric Balletbo i Serra
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=c57b0892-d68d-f0f2-3cc1-b8549983227e@collabora.com \
--to=enric.balletbo@collabora.com \
--cc=bleung@chromium.org \
--cc=dlunev@chromium.org \
--cc=groeck@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmalani@chromium.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
all inboxes | Powered by JetHome®