From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: platform-driver-x86@vger.kernel.org,
Hans de Goede <hansg@kernel.org>,
Junrui Luo <moonafterrain@outlook.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86: ibm_rtl: Fix potential OOB read at signature search
Date: Tue, 20 Oct 2026 16:52:28 +0300 (EEST) [thread overview]
Message-ID: <818a69b8-785f-9eec-d93a-89c8833d94fc@linux.intel.com> (raw)
In-Reply-To: <20261020130301.351768-1-tiwai@suse.de>
On Tue, 20 Oct 2026, Takashi Iwai wrote:
> The loop for signature search fetches 8 bytes at each check,
But that's not all it's going to access??
> while the
> loop count is calculated in 4 bytes unit, which means that, at the
> last entry, it fetches over the limit.
>
> Correct the boundary condition to "ebda_size/sizeof(unsigned int)-1"
This seems even more obfuscated than this code already is!
I think it should do this instead:
(ebda_size - sizeof(*rtl_table)) / sizeof(u32)
Admittedly, it a logical change too but why you think only partial RTL
table is good enough just because signature can be checked? After the sig
check, it will read the struct beyond that.
...And that other sizeof() should use u32 as well.
Unrelated to this change and if you have this HW and can test changes, it
would be nice to also get rid of the debug parameter and use dynamic
debugging instead of RTL_DEBUG() for consistency.
I also don't understand why it's mixing readq() and ioread*() for reading
from the same area.
> for avoiding the potential OOB access.
>
> Fixes: 15dd100349b8 ("platform/x86: ibm_rtl: fix EBDA signature search pointer arithmetic")
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> drivers/platform/x86/ibm_rtl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
> index 139956168cf9..6d6998049d8c 100644
> --- a/drivers/platform/x86/ibm_rtl.c
> +++ b/drivers/platform/x86/ibm_rtl.c
> @@ -271,7 +271,7 @@ static int __init ibm_rtl_init(void) {
> return -ENOMEM;
>
> /* search for the _RTL_ signature at the start of the table */
> - for (i = 0 ; i < ebda_size/sizeof(unsigned int); i++) {
> + for (i = 0 ; i < ebda_size/sizeof(unsigned int) - 1; i++) {
Also remove that extra space after i = 0.
> struct ibm_rtl_table __iomem * tmp;
> tmp = (struct ibm_rtl_table __iomem *) (ebda_map + i*sizeof(unsigned int));
> if ((readq(&tmp->signature) & RTL_MASK) == RTL_SIGNATURE) {
>
--
i.
next prev parent reply other threads:[~2026-10-20 13:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 13:02 Takashi Iwai
2026-10-20 13:52 ` Ilpo Järvinen [this message]
2026-10-20 14:17 ` Takashi Iwai
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=818a69b8-785f-9eec-d93a-89c8833d94fc@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=moonafterrain@outlook.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tiwai@suse.de \
/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®