Re: [PATCH v2] zloop: log new device before marking it live
From: Damien Le Moal
Date: Wed Dec 02 2026 - 00:50:42 EST
On 12/2/26 03:55, Bilal Hashim wrote:
> In zloop_ctl_add(), zlo->state is transitioned to Zlo_live and
> zloop_ctl_mutex is unlocked before logging zlo fields with pr_info().
>
> Once zlo->state becomes Zlo_live, a concurrent zloop_ctl_remove() can
> remove the device and free zlo via put_disk() -> zloop_free_disk() before
> pr_info() reads zlo->id, zlo->nr_zones, zlo->zone_size, zlo->block_size,
> zlo->ordered_zone_append, and zlo->zone_append, resulting in a
> slab-use-after-free read.
>
> Move the two pr_info() calls before transitioning zlo->state to Zlo_live.
>
> Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
> Signed-off-by: Bilal Hashim <AeeSec@xxxxxxx>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
--
Damien Le Moal
Western Digital Research