[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025090237-undocked-reopen-7ce6@gregkh>
Date: Tue, 2 Sep 2025 06:49:45 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Aleksandr Shabelnikov <mistermidi@...il.com>
Cc: o-takashi@...amocchi.jp, linux1394-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] firewire: core: bound traversal stack in
read_config_rom()
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@...il.com>
> Suggested-by: Aleksandr Shabelnikov <mistermidi@...il.com>
>
> Signed-off-by: Aleksandr Shabelnikov <mistermidi@...il.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
Powered by blists - more mailing lists