The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH] dm snapshot: fix double vfree in alloc_area() error path
       [not found] <20261127113459.743859-1-deepak.os.system@gmail.com>
@ 2026-11-27 11:35 ` syzbot
  0 siblings, 0 replies; only message in thread
From: syzbot @ 2026-11-27 11:35 UTC (permalink / raw)
  To: deepak.os.system; +Cc: deepak.os.system, linux-kernel, syzkaller-bugs

> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Patch testing via #syz test is temporarily disabled.
See https://github.com/google/syzkaller/issues/8122 for details.

>
> If alloc_area() fails to allocate ps->zero_area or ps->header_area, it
> frees the previously allocated buffers without resetting ps->area and
> ps->zero_area to NULL. When snapshot_ctr() subsequently cleans up via
> dm_exception_store_destroy() -> persistent_dtr() -> free_area(), those
> dangling pointers are passed to vfree() a second time, triggering a
> WARNING in mm/vmalloc.c ("Trying to vfree() nonexistent vm area").
>
> Reset ps->zero_area and ps->area to NULL after freeing them in
> alloc_area()'s error path.
>
> Fixes: 61578dcd3faf ("dm snapshot: fix header corruption race on invalidation")
> Cc: stable@vger.kernel.org
> Reported-by: syzbot+1eda626824b6334f5ad3@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=1eda626824b6334f5ad3
> Signed-off-by: Deepak Pandey <deepak.os.system@gmail.com>
> ---
>  drivers/md/dm-snap-persistent.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
> index b587ee733056..9f5ade4f51ce 100644
> --- a/drivers/md/dm-snap-persistent.c
> +++ b/drivers/md/dm-snap-persistent.c
> @@ -194,9 +194,11 @@ static int alloc_area(struct pstore *ps)
>  
>  err_header_area:
>  	vfree(ps->zero_area);
> +	ps->zero_area = NULL;
>  
>  err_zero_area:
>  	vfree(ps->area);
> +	ps->area = NULL;
>  
>  err_area:
>  	return r;
> -- 
> 2.56.1
>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-27 11:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261127113459.743859-1-deepak.os.system@gmail.com>
2026-11-27 11:35 ` [PATCH] dm snapshot: fix double vfree in alloc_area() error path syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox