From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Muhammad Bilal <meatuni001@gmail.com>
Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
Vaibhav Agarwal <vaibhav.sr@gmail.com>,
Mark Greer <mgreer@animalcreek.com>,
Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: audio: bound topology parsing to the received buffer
Date: Fri, 17 Jul 2026 14:13:01 +0200 [thread overview]
Message-ID: <2026071744-unsteady-easter-16ab@gregkh> (raw)
In-Reply-To: <20260710212312.117781-1-meatuni001@gmail.com>
On Sat, Jul 11, 2026 at 02:23:12AM +0500, Muhammad Bilal wrote:
> The Greybus audio topology parser trusts length and count fields taken
> straight from the module's topology blob and never checks them against
> the size of the buffer it actually allocated, leading to out-of-bounds
> reads of the kernel heap.
>
> gb_audio_gb_get_topology() reads a u16 size from the module, allocates a
> buffer of that size, fetches the topology into it, and then discards the
> size. gbaudio_tplg_parse_data() then walks that buffer using fields
> stored inside it:
>
> - gbaudio_tplg_process_header() computes the control, widget and route
> block offsets by adding the wire-supplied __le32 size_dais,
> size_controls and size_widgets onto the buffer base with no bound, so
> a module that reports a small allocation size but large block sizes
> moves those offsets far past the end of the buffer before they are
> dereferenced.
>
> - gbaudio_tplg_process_kcontrols(), _process_widgets() and
> _process_routes() iterate num_controls / num_widgets / num_routes
> (also from the blob) and advance a pointer by a per-element size that
> includes the __le16 names_length of an enumerated control, again with
> no check that the element stays inside the buffer.
>
> - gb_generate_enum_strings() loops over an attacker-controlled __le32
> items count and, for each, scans for a NUL terminator with no end
> pointer, walking off the end of the buffer.
>
> A malicious or malfunctioning module can therefore make the parser read
> past the allocation. The wild block offsets are most likely to hit an
> unmapped page and oops (denial of service); the byte-at-a-time enum scan
> walks from a still-valid pointer and can copy adjacent heap bytes into
> ALSA control name strings, which are readable by unprivileged local
> users, so an information leak cannot be ruled out.
>
> Thread the allocated topology size from gb_audio_gb_get_topology()
> through to gbaudio_tplg_parse_data() and bound every walk against the end
> of the buffer: verify the block offsets are ordered and within the
> buffer (the "< previous" tests also catch a 32-bit unsigned wrap of the
> running offset), check each control, widget and route lies fully inside
> its block before use, and give gb_generate_enum_strings() an explicit
> end pointer plus an items-versus-names_length sanity check.
>
> Fixes: 6339d2322c47 ("greybus: audio: Add topology parser for GB codec")
> Cc: stable@vger.kernel.org
> Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
How was this found, and tested?
thanks,
greg k-h
next prev parent reply other threads:[~2026-07-17 12:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 21:23 [PATCH] staging: greybus: audio: bound topology parsing to the received buffer Muhammad Bilal
2026-07-17 12:13 ` Greg Kroah-Hartman [this message]
2026-07-17 12:56 ` Muhammad Bilal
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=2026071744-unsteady-easter-16ab@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=meatuni001@gmail.com \
--cc=mgreer@animalcreek.com \
--cc=stable@vger.kernel.org \
--cc=vaibhav.sr@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.