Lidong Chen 99b4c0c384 disk/mdraid1x_linux: Prevent infinite recursion
The test corpus for version-1 RAID generated an infinite recursion
in grub_partition_iterate() while attempting to read the superblock.
The reason for the issue was that the data region overlapped with
the superblock.

The infinite call loop looks like this:
  grub_partition_iterate() -> partmap->iterate() ->
    -> grub_disk_read() -> grub_disk_read_small() ->
    -> grub_disk_read_small_real() -> grub_diskfilter_read() ->
    -> read_lv() -> read_segment() -> grub_diskfilter_read_node() ->
    -> grub_disk_read() -> grub_disk_read_small() -> ...

The fix adds checks for both the superblock region and the data
region when parsing the superblock metadata in grub_mdraid_detect().

Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2024-05-09 15:25:46 +02:00
..
2019-03-25 15:14:52 +01:00
2023-06-01 11:45:00 +02:00
2022-03-14 15:44:45 +01:00
2023-06-01 11:45:00 +02:00
2023-01-19 17:39:04 +01:00
2022-03-14 15:44:45 +01:00
2012-03-26 16:10:40 +02:00
2019-03-25 15:14:52 +01:00
2022-03-14 15:44:45 +01:00
2022-03-14 15:44:45 +01:00