From: Sudeep Holla <sudeep.holla@arm.com>
To: huhai <15815827059@163.com>
Cc: cristian.marussi@arm.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, luriwen@kylinos.cn,
liuyun01@kylinos.cn, huhai <huhai@kylinos.cn>,
k2ci <kernel-bot@kylinos.cn>
Subject: Re: [PATCH] firmware: arm_scpi: Fix error handle when scpi probe failed
Date: Fri, 1 Jul 2022 10:42:12 +0100 [thread overview]
Message-ID: <20220701094212.snsnbdjc7hia5oti@bogus> (raw)
In-Reply-To: <20220701061606.151366-1-15815827059@163.com>
On Fri, Jul 01, 2022 at 02:16:06PM +0800, huhai wrote:
> From: huhai <huhai@kylinos.cn>
>
> When scpi probe fails, do not just return the error code, but also reset
> the global scpi_info to NULL, otherwise scpi_hwmon_probe() may get a UAF
> and cause panic:
>
Interesting, which platform are you using this on ? SCPI is deprecated for
a while, please switch to SCMI which is well maintained both in terms of
specification and support in the kernel. I also assume this is 64-bit
platform, so I don't want you to get stuck in future because of lack
of some feature in SCPI. Please see if you can migrate to SCMI.
> scpi_protocol FTSC0001:00: incorrect or no SCP firmware found
> ... ...
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> Mem abort info:
>
[...]
I think we don't see to make it complex. Can't it be as simple as:
Regards,
Sudeep
-->8
diff --git i/drivers/firmware/arm_scpi.c w/drivers/firmware/arm_scpi.c
index ddf0b9ff9e15..6fa1a5b193b8 100644
--- i/drivers/firmware/arm_scpi.c
+++ w/drivers/firmware/arm_scpi.c
@@ -799,7 +799,7 @@ static struct scpi_ops scpi_ops = {
struct scpi_ops *get_scpi_ops(void)
{
- return scpi_info ? scpi_info->scpi_ops : NULL;
+ return scpi_info && scpi_info->scpi_ops ? scpi_info->scpi_ops : NULL;
}
EXPORT_SYMBOL_GPL(get_scpi_ops);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-07-01 9:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-01 6:16 [PATCH] firmware: arm_scpi: Fix error handle when scpi probe failed huhai
2022-07-01 9:42 ` Sudeep Holla [this message]
2022-07-01 9:52 ` huhai
2022-07-01 10:00 ` Sudeep Holla
2022-07-01 10:04 ` huhai
2022-07-01 12:34 ` Sudeep Holla
2022-07-01 14:38 ` huhai
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=20220701094212.snsnbdjc7hia5oti@bogus \
--to=sudeep.holla@arm.com \
--cc=15815827059@163.com \
--cc=cristian.marussi@arm.com \
--cc=huhai@kylinos.cn \
--cc=kernel-bot@kylinos.cn \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyun01@kylinos.cn \
--cc=luriwen@kylinos.cn \
/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