The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: syzbot <syzbot+1eda626824b6334f5ad3@syzkaller.appspotmail.com>
To: deepak.os.system@gmail.com
Cc: deepak.os.system@gmail.com, linux-kernel@vger.kernel.org,
	 syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] dm snapshot: fix double vfree in alloc_area() error path
Date: Fri, 27 Nov 2026 03:35:06 -0800	[thread overview]
Message-ID: <6b096aea.b83081fb.4cb0e.0022.GAE@google.com> (raw)
In-Reply-To: <20261127113459.743859-1-deepak.os.system@gmail.com>

> #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
>

           reply	other threads:[~2026-11-27 11:35 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20261127113459.743859-1-deepak.os.system@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b096aea.b83081fb.4cb0e.0022.GAE@google.com \
    --to=syzbot+1eda626824b6334f5ad3@syzkaller.appspotmail.com \
    --cc=deepak.os.system@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox