lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <123e2014-59e0-4c0a-905f-c2fee4455eb8@suse.com>
Date: Fri, 12 Dec 2025 10:25:17 +1030
From: Qu Wenruo <wqu@...e.com>
To: Deepanshu Kartikey <kartikey406@...il.com>, clm@...com, dsterba@...e.com,
 miaox@...fujitsu.com
Cc: linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
 syzbot+eadd98df8bceb15d7fed@...kaller.appspotmail.com
Subject: Re: [PATCH] btrfs: fix memory leak of fs_devices in degraded seed
 device path



在 2025/12/10 23:58, Deepanshu Kartikey 写道:
> In open_seed_devices(), when find_fsid() fails and we're in DEGRADED
> mode, a new fs_devices is allocated via alloc_fs_devices() but is never
> added to the seed_list before returning. This contrasts with the normal
> path where fs_devices is properly added via list_add().
> 
> If any error occurs later in read_one_dev() or btrfs_read_chunk_tree(),
> the cleanup code iterates seed_list to free seed devices, but this
> orphaned fs_devices is never found and never freed, causing a memory
> leak. Any devices allocated via add_missing_dev() and attached to this
> fs_devices are also leaked.
> 
> Fix this by adding the newly allocated fs_devices to seed_list in the
> degraded path, consistent with the normal path.
> 
> Fixes: 5f37583569442 ("Btrfs: move the missing device to its own fs device list")
> Reported-by: syzbot+eadd98df8bceb15d7fed@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=eadd98df8bceb15d7fed
> Tested-by: syzbot+eadd98df8bceb15d7fed@...kaller.appspotmail.com
> Signed-off-by: Deepanshu Kartikey <kartikey406@...il.com>

Reviewed-by: Qu Wenruo <wqu@...e.com>

Thanks,
Qu

> ---
>   fs/btrfs/volumes.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index ae1742a35e76..13c514684cfb 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -7128,6 +7128,7 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_fs_info *fs_info,
>   
>   		fs_devices->seeding = true;
>   		fs_devices->opened = 1;
> +		list_add(&fs_devices->seed_list, &fs_info->fs_devices->seed_list);
>   		return fs_devices;
>   	}
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ