diff options
| author | Guangshuo Li <lgs201920130244@gmail.com> | 2026-04-01 18:56:19 +0800 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-04-07 18:56:09 +0200 |
| commit | 3f487be81292702a59ea9dbc4088b3360a50e837 (patch) | |
| tree | e1fdbce05c5399660922caa8e12abdbc9c864ecd /drivers/char/drm/git@git.tavy.me:linux.git | |
| parent | a7449edf96143f192606ec8647e3167e1ecbd728 (diff) | |
btrfs: fix double free in create_space_info() error path
When kobject_init_and_add() fails, the call chain is:
create_space_info()
-> btrfs_sysfs_add_space_info_type()
-> kobject_init_and_add()
-> failure
-> kobject_put(&space_info->kobj)
-> space_info_release()
-> kfree(space_info)
Then control returns to create_space_info():
btrfs_sysfs_add_space_info_type() returns error
-> goto out_free
-> kfree(space_info)
This causes a double free.
Keep the direct kfree(space_info) for the earlier failure path, but
after btrfs_sysfs_add_space_info_type() has called kobject_put(), let
the kobject release callback handle the cleanup.
Fixes: a11224a016d6d ("btrfs: fix memory leaks in create_space_info() error paths")
CC: stable@vger.kernel.org # 6.19+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'drivers/char/drm/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
