* [PATCH v2] platform/x86: ibm_rtl: Fix potential OOB read at signature search
@ 2026-10-21 6:39 Takashi Iwai
2026-10-21 10:06 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Iwai @ 2026-10-21 6:39 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: platform-driver-x86, Hans de Goede, Junrui Luo, linux-kernel
The loop for signature search fetches 22 bytes of struct ibm_rtl_table
at each check, while the loop count is calculated in 4 bytes unit,
which means that, at the last entry, it fetches over the limit.
Rewrite the loop to use the byte offset and correct the boundary
condition check 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>
---
v1->v2: Replace loop counter with offset and correct boundary check
drivers/platform/x86/ibm_rtl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 139956168cf9..82fda8d9178b 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -234,9 +234,9 @@ static const struct dmi_system_id ibm_rtl_dmi_table[] __initconst = {
};
static int __init ibm_rtl_init(void) {
- unsigned long ebda_addr, ebda_size;
+ unsigned long ebda_addr, ebda_size, offset;
unsigned int ebda_kb;
- int ret = -ENODEV, i;
+ int ret = -ENODEV;
if (force)
pr_warn("module loaded by force\n");
@@ -271,9 +271,9 @@ 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 (offset = 0; offset + sizeof(*rtl_table) <= ebda_size; offset += 4) {
struct ibm_rtl_table __iomem * tmp;
- tmp = (struct ibm_rtl_table __iomem *) (ebda_map + i*sizeof(unsigned int));
+ tmp = (struct ibm_rtl_table __iomem *) (ebda_map + offset);
if ((readq(&tmp->signature) & RTL_MASK) == RTL_SIGNATURE) {
phys_addr_t addr;
unsigned int plen;
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] platform/x86: ibm_rtl: Fix potential OOB read at signature search
2026-10-21 6:39 [PATCH v2] platform/x86: ibm_rtl: Fix potential OOB read at signature search Takashi Iwai
@ 2026-10-21 10:06 ` Ilpo Järvinen
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2026-10-21 10:06 UTC (permalink / raw)
To: Takashi Iwai; +Cc: platform-driver-x86, Hans de Goede, Junrui Luo, linux-kernel
On Wed, 21 Oct 2026 08:39:55 +0200, Takashi Iwai wrote:
> The loop for signature search fetches 22 bytes of struct ibm_rtl_table
> at each check, while the loop count is calculated in 4 bytes unit,
> which means that, at the last entry, it fetches over the limit.
>
> Rewrite the loop to use the byte offset and correct the boundary
> condition check for avoiding the potential OOB access.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
FYI [if applicable to your patch], as per Linus' policy change, also
fixes are mostly routed through for-next unless the fix is for a
commit introduced in the most recent cycle or is clearly a regression
fix.
The list of commits applied:
[1/1] platform/x86: ibm_rtl: Fix potential OOB read at signature search
commit: f1d81af2521ad504a20481fef12c358d26e6c3a6
--
i.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-21 10:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 6:39 [PATCH v2] platform/x86: ibm_rtl: Fix potential OOB read at signature search Takashi Iwai
2026-10-21 10:06 ` Ilpo Järvinen
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®