From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Igor Opaniuk <igor.opaniuk@gmail.com>, u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
"Guillaume La Roque (TI.com)" <glaroque@baylibre.com>,
"Nicolas Belin (TI.com)" <nbelin@baylibre.com>,
Francois Berder <fberder@outlook.fr>,
Sam Protsenko <semen.protsenko@linaro.org>,
Igor Opaniuk <igor.opaniuk@gmail.com>
Subject: Re: [PATCH 2/2] avb: free mmc_part allocated by get_partition()
Date: Thu, 23 Jul 2026 14:53:59 +0200 [thread overview]
Message-ID: <878q71989k.fsf@kernel.org> (raw)
In-Reply-To: <20260712-avb-fix-memory-leaks-v1-2-51d6d5a42631@gmail.com>
Hi Igor,
Thank you for the patch.
On Sun, Jul 12, 2026 at 10:50, Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
> get_partition() returns a malloc()'d struct mmc_part and only frees it on
> its own internal error path. None of its callers - mmc_byte_io(),
> get_unique_guid_for_partition() and get_size_of_partition() - free the
> returned pointer, so every partition access leaks one struct mmc_part.
> A single "avb verify" issues many such accesses (footer, vbmeta and the
> hashed image chunks), so the leak accumulates quickly.
>
> Free the descriptor in all three callers. mmc_byte_io() is reworked to
> use a single exit path so the partition is released on every return.
>
> Fixes: 3af30e4443aa ("avb2.0: implement AVB ops")
> Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
next prev parent reply other threads:[~2026-07-23 12:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-12 8:50 [PATCH 0/2] avb: fix memory leaks in AVB 2.0 verification path Igor Opaniuk
2026-07-12 8:50 ` [PATCH 1/2] boot: android: fix AvbOps and verify-data leaks in AVB path Igor Opaniuk
2026-07-23 12:48 ` Mattijs Korpershoek
2026-07-12 8:50 ` [PATCH 2/2] avb: free mmc_part allocated by get_partition() Igor Opaniuk
2026-07-23 12:53 ` Mattijs Korpershoek [this message]
2026-07-15 16:29 ` [PATCH 0/2] avb: fix memory leaks in AVB 2.0 verification path Igor Opaniuk
2026-07-21 8:28 ` Mattijs Korpershoek via U-Boot
2026-07-24 12:43 ` Mattijs Korpershoek
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=878q71989k.fsf@kernel.org \
--to=mkorpershoek@kernel.org \
--cc=fberder@outlook.fr \
--cc=glaroque@baylibre.com \
--cc=igor.opaniuk@gmail.com \
--cc=nbelin@baylibre.com \
--cc=semen.protsenko@linaro.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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