partitions: aix: bound the lvd scan to one sector#935
Conversation
|
Upstream branch: ddd664b |
7bed9c3 to
a7bb5c5
Compare
|
Upstream branch: 979c294 |
cab902d to
ad07641
Compare
a7bb5c5 to
5e41a3b
Compare
|
Upstream branch: acb7500 |
ad07641 to
2044088
Compare
5e41a3b to
c3a084b
Compare
|
Upstream branch: 9716c08 |
2044088 to
17a2d2e
Compare
c3a084b to
5f78e5d
Compare
|
Upstream branch: 2a2974b |
17a2d2e to
5b14dce
Compare
5f78e5d to
e48f9db
Compare
|
Upstream branch: 062871f |
5b14dce to
25e182b
Compare
199644a to
e6d9eb8
Compare
|
Upstream branch: 66affa3 |
25e182b to
9a680f3
Compare
e6d9eb8 to
7d8604f
Compare
|
Upstream branch: bade58e |
9a680f3 to
52e4e85
Compare
7d8604f to
4cc45a3
Compare
|
Upstream branch: 4edcdef |
52e4e85 to
665a519
Compare
4cc45a3 to
90ffd56
Compare
|
Upstream branch: dc59e4f |
aix_partition() reads the logical-volume descriptor array as a single
sector and then scans it:
if (numlvs && (d = read_part_sector(state, vgda_sector + 1, §))) {
struct lvd *p = (struct lvd *)d;
...
for (i = 0; foundlvs < numlvs && i < state->limit; i += 1) {
lvip[i].pps_per_lv = be16_to_cpu(p[i].num_lps);
p points at a single 512-byte sector, which holds 512 / sizeof(struct
lvd) = 16 entries, but the loop runs until foundlvs reaches the on-disk
numlvs or i reaches state->limit (DISK_MAX_PARTS, 256). numlvs is an
on-disk __be16 read straight from the volume group descriptor and is not
validated, so a crafted AIX image with numlvs larger than 16 and lvd
entries whose num_lps fields are zero (so foundlvs never advances) drives
the loop to read p[i] well past the end of the read sector buffer.
The 2014 off-by-one fix d97a86c hardened the matching write of
lvip[lv_ix] but left this read loop unbounded.
Bound the scan to the number of struct lvd entries that fit in the
sector that was actually read.
Fixes: 6ceea22 ("partitions: add aix lvm partition support files")
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
665a519 to
6ad93db
Compare
Pull request for series with
subject: partitions: aix: bound the lvd scan to one sector
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1107036