mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	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: Wed, 21 Oct 2026 08:29:40 +0200	[thread overview]
Message-ID: <87mrs7ftwr.wl-tiwai@suse.de> (raw)
In-Reply-To: <4d28c3ce-63f7-399e-9798-4f35e60c608b@linux.intel.com>

On Tue, 20 Oct 2026 22:20:50 +0200,
Ilpo Järvinen wrote:
> 
> On Tue, 20 Oct 2026, Takashi Iwai wrote:
> 
> > On Tue, 20 Oct 2026 15:52:28 +0200,
> > Ilpo Järvinen wrote:
> > > 
> > > 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??
> > 
> > Oh indeed it access further.
> > 
> > > > 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!
> > 
> > Yeah, the driver code is really ugly, and I made a whip cream on the
> > top :)
> > 
> > > I think it should do this instead:
> > > 
> > > (ebda_size - sizeof(*rtl_table)) / sizeof(u32)
> > 
> > Hrm, this will result in the omit of the last loop entry?
> > 
> > I guess it'd be better understandable rather by directly adding the
> > offset in the loop instead of the counter.  Something like below.
> 
> The patch below looks fine sans one nit but could you please send it in 
> own thread so it gets captured by patchwork & sashiko & etc.

OK, will do.

(snip)
> > @@ -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) {
> 
> Nit, remove the extra space before semicolon.

Will be corrected in the next submission.


thanks,

Takashi

      reply	other threads:[~2026-10-21  6:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 13:02 Takashi Iwai
2026-10-20 13:52 ` Ilpo Järvinen
2026-10-20 14:17   ` Takashi Iwai
2026-10-20 20:20     ` Ilpo Järvinen
2026-10-21  6:29       ` Takashi Iwai [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=87mrs7ftwr.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=moonafterrain@outlook.com \
    --cc=platform-driver-x86@vger.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

all inboxes | Powered by JetHome®