bcachefs: fix error path of __bch2_read_super()
In __bch2_read_super(), if kstrdup() fails, it needs to release memory in sb->holder, fix to call bch2_free_super() in the error path. Signed-off-by: Chao Yu <chao@kernel.org> Reviewed-by: Hongbo Li <lihongbo22@huawei.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
f0a73d4fde
commit
3078e059a5
@ -700,8 +700,11 @@ retry:
|
||||
return -ENOMEM;
|
||||
|
||||
sb->sb_name = kstrdup(path, GFP_KERNEL);
|
||||
if (!sb->sb_name)
|
||||
return -ENOMEM;
|
||||
if (!sb->sb_name) {
|
||||
ret = -ENOMEM;
|
||||
prt_printf(&err, "error allocating memory for sb_name");
|
||||
goto err;
|
||||
}
|
||||
|
||||
#ifndef __KERNEL__
|
||||
if (opt_get(*opts, direct_io) == false)
|
||||
|
Loading…
Reference in New Issue
Block a user