* [PATCH] btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod
@ 2020-10-21 5:36 Dinghao Liu
2020-11-05 11:51 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-10-21 5:36 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel
There is one error handling path does not free ref,
which may cause a memory leak.
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..78693d3dd15b 100644
--- a/fs/btrfs/ref-verify.c
+++ b/fs/btrfs/ref-verify.c
@@ -860,6 +860,7 @@ int btrfs_ref_tree_mod(struct btrfs_fs_info *fs_info,
"dropping a ref for a root that doesn't have a ref on the block");
dump_block_entry(fs_info, be);
dump_ref_action(fs_info, ra);
+ kfree(ref);
kfree(ra);
goto out_unlock;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod
2020-10-21 5:36 [PATCH] btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod Dinghao Liu
@ 2020-11-05 11:51 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-11-05 11:51 UTC (permalink / raw)
To: Dinghao Liu
Cc: kjlu, Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel
On Wed, Oct 21, 2020 at 01:36:55PM +0800, Dinghao Liu wrote:
> There is one error handling path does not free ref,
> which may cause a memory leak.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-05 11:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 5:36 [PATCH] btrfs: ref-verify: Fix memleak in btrfs_ref_tree_mod Dinghao Liu
2020-11-05 11:51 ` David Sterba
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).