* [PATCH] btrfs: ref-verify: Fix memleak in add_extent_data_ref
@ 2020-08-27 7:43 Dinghao Liu
2020-10-09 14:30 ` Josef Bacik
0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-08-27 7:43 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel
When lookup_root_entry() fails, ref should be freed
just like when insert_ref_entry() fails.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
fs/btrfs/ref-verify.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c
index 7f03dbe5b609..712f5cfde404 100644
--- a/fs/btrfs/ref-verify.c
+++ b/fs/btrfs/ref-verify.c
@@ -419,6 +419,7 @@ static int add_extent_data_ref(struct btrfs_fs_info *fs_info,
if (!re) {
spin_unlock(&fs_info->ref_verify_lock);
btrfs_err(fs_info, "missing root in new block entry?");
+ kfree(ref);
return -EINVAL;
}
re->num_refs += num_refs;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: ref-verify: Fix memleak in add_extent_data_ref
2020-08-27 7:43 [PATCH] btrfs: ref-verify: Fix memleak in add_extent_data_ref Dinghao Liu
@ 2020-10-09 14:30 ` Josef Bacik
0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2020-10-09 14:30 UTC (permalink / raw)
To: Dinghao Liu, kjlu; +Cc: Chris Mason, David Sterba, linux-btrfs, linux-kernel
On 8/27/20 3:43 AM, Dinghao Liu wrote:
> When lookup_root_entry() fails, ref should be freed
> just like when insert_ref_entry() fails.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-09 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 7:43 [PATCH] btrfs: ref-verify: Fix memleak in add_extent_data_ref Dinghao Liu
2020-10-09 14:30 ` Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).