On Tue, 2026-07-21 at 02:27 -0400, Benjamin Marzinski wrote:
> After commit 03071031 ("kpartx: fix crash and truncated device
> creation
> with long -p delimiter"), when attempting to remove deleted
> partitions
> on kpartx -u, kpartx started calling dm_find_part() to check if the
> partition existed before checking if the slice size was 0 (and thus
> should get removed). The problem is that if dm_find_part() returns
> DFP_DEVICE_RELOAD because the partition device exists, part_uuid gets
> allocated, and if the slices[j].size is non-zero and the partition
> device shouldn't be removed, part_uuid wasn't getting freed. Fix this
> by
> reverting to checking the slice size first.
>
> Fixes: 03071031 ("kpartx: fix crash and truncated device creation
> with long -p delimiter")
>
> Signed-off-by: Benjamin Marzinski <[email protected]>
Good catch, thanks!
Reviewed-by: Martin Wilck <[email protected]>