From: Greg KH <gregkh@linuxfoundation.org>
To: Aleksandr Shabelnikov <mistermidi@gmail.com>
Cc: o-takashi@sakamocchi.jp, linux1394-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firewire: core: bound traversal stack in read_config_rom()
Date: Tue, 2 Sep 2025 06:49:45 +0200 [thread overview]
Message-ID: <2025090237-undocked-reopen-7ce6@gregkh> (raw)
In-Reply-To: <20250901171547.47065-1-mistermidi@gmail.com>
On Mon, Sep 01, 2025 at 07:15:47PM +0200, Aleksandr Shabelnikov wrote:
> read_config_rom() walks Configuration ROM directories using an explicit
> stack but pushes new entries without a bound check:
>
> stack[sp++] = i + rom[i];
>
> A malicious or malformed Configuration ROM can construct in-range cyclic
> directory references so that the traversal keeps enqueueing, growing the
> stack past its allocated depth. rom[] and stack[] are allocated adjacent
> in a single kmalloc() block, so this leads to a heap out-of-bounds write.
>
> Add a hard bound check before every push. While this does not itself
> implement cycle detection, it prevents memory corruption and limits the
> impact to a clean failure (-EOVERFLOW).
>
> Reported-by: Aleksandr Shabelnikov <mistermidi@gmail.com>
> Suggested-by: Aleksandr Shabelnikov <mistermidi@gmail.com>
>
> Signed-off-by: Aleksandr Shabelnikov <mistermidi@gmail.com>
Nit, you only need the last one "reported-by" and "suggested-by" don't
mean anything when it is you as the author and signed-off-by line :)
thanks,
greg k-h
prev parent reply other threads:[~2025-09-02 4:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-01 17:15 Aleksandr Shabelnikov
2025-09-02 4:49 ` Greg KH [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=2025090237-undocked-reopen-7ce6@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=mistermidi@gmail.com \
--cc=o-takashi@sakamocchi.jp \
/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®