From: Philippe De Muyter <phdm@macqel.be>
To: Michael Bommarito <michael.bommarito@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>, Hannes Reinecke <hare@suse.de>,
Kees Cook <kees@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] partitions: aix: bound the lvd scan to one sector
Date: Thu, 30 Jul 2026 15:10:46 +0200 [thread overview]
Message-ID: <20260730131046.GB4502@frolo.corp.macq.eu> (raw)
In-Reply-To: <20260714114806.3761553-1-michael.bommarito@gmail.com>
On Tue, Jul 14, 2026 at 07:48:06AM -0400, Michael Bommarito wrote:
> aix_partition() reads the logical-volume descriptor array as a single
> sector and then scans it:
>
> ...
>
> Bound the scan to the number of struct lvd entries that fit in the
> sector that was actually read.
>
> ...
>
> diff --git a/block/partitions/aix.c b/block/partitions/aix.c
> index f3c4174e003e9..689837deba279 100644
> --- a/block/partitions/aix.c
> +++ b/block/partitions/aix.c
> @@ -208,7 +208,14 @@ int aix_partition(struct parsed_partitions *state)
> if (n) {
> int foundlvs = 0;
>
> - for (i = 0; foundlvs < numlvs && i < state->limit; i += 1) {
> + /*
> + * The lvd array was read as a single sector; only the
> + * struct lvd entries that fit in it are valid. Bound the
> + * scan so an on-disk numlvs larger than that cannot walk
I'd prefer the comment not to need wrapping at 80 columns, even in a patch ...
> + * the read buffer out of bounds.
> + */
> + for (i = 0; foundlvs < numlvs && i < state->limit &&
> + i < SECTOR_SIZE / (int)sizeof(struct lvd); i++) {
> lvip[i].pps_per_lv = be16_to_cpu(p[i].num_lps);
> if (lvip[i].pps_per_lv)
> foundlvs += 1;
> --
> 2.53.0
but nevertheless
Reviewed-by: Philippe De Muyter <phdm@macqel.be>
Thanks
Philippe
prev parent reply other threads:[~2026-07-30 13:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 11:48 [PATCH v2] partitions: aix: bound the lvd scan to one sector Michael Bommarito
2026-07-15 22:34 ` Jens Axboe
2026-07-30 13:10 ` Philippe De Muyter [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=20260730131046.GB4502@frolo.corp.macq.eu \
--to=phdm@macqel.be \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=kees@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.bommarito@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox