[pve-devel] [PATCH installer 4/4] common: enforce even number of disks for ZFS RAID-10

Christoph Heiss c.heiss at proxmox.com
Tue Nov 21 11:54:20 CET 2023


Sent bit to quickly and missed the proper prefix; this fixes #5050 [0].

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=5050

On Tue, Nov 21, 2023 at 11:45:51AM +0100, Christoph Heiss wrote:
>
> An uneven number of disks otherwise causes a panic due to an
> out-of-bounds array access in the loop below.
>
> Reported-by: Fiona Ebner <f.ebner at proxmox.com>
> Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
> ---
>  proxmox-installer-common/src/disk_checks.rs | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/proxmox-installer-common/src/disk_checks.rs b/proxmox-installer-common/src/disk_checks.rs
> index bcf2e21..7cbdf19 100644
> --- a/proxmox-installer-common/src/disk_checks.rs
> +++ b/proxmox-installer-common/src/disk_checks.rs
> @@ -81,6 +81,14 @@ pub fn check_zfs_raid_config(level: ZfsRaidLevel, disks: &[Disk]) -> Result<(),
>          }
>          ZfsRaidLevel::Raid10 => {
>              check_raid_min_disks(disks, 4)?;
> +
> +            if disks.len() % 2 != 0 {
> +                return Err(format!(
> +                    "Needs an even number of disks, currently selected: {}",
> +                    disks.len(),
> +                ));
> +            }
> +
>              // Pairs need to have the same size
>              for i in (0..disks.len()).step_by(2) {
>                  check_mirror_size(&disks[i], &disks[i + 1])?;
> --
> 2.42.0
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>





More information about the pve-devel mailing list