linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Btrfs: dereferencing free'd memory in panic message
@ 2012-06-22  7:14 Dan Carpenter
  2012-06-22 13:09 ` Josef Bacik
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2012-06-22  7:14 UTC (permalink / raw)
  To: Chris Mason; +Cc: linux-btrfs, kernel-janitors

We free "node" and then dereference it in the panic message on the next
line.  I considered moving the kfree() after the panic given that panic
can return under certain configurations, but in the end I decided it
doesn't matter if we leak a bit after a panic.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 790f492..c50d80a 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1239,7 +1239,6 @@ static int __must_check __add_reloc_root(struct btrfs_root *root)
 			      node->bytenr, &node->rb_node);
 	spin_unlock(&rc->reloc_root_tree.lock);
 	if (rb_node) {
-		kfree(node);
 		btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found "
 			    "for start=%llu while inserting into relocation "
 			    "tree\n", node->bytenr);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-06-26  6:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-22  7:14 [patch] Btrfs: dereferencing free'd memory in panic message Dan Carpenter
2012-06-22 13:09 ` Josef Bacik
2012-06-22 13:30   ` Dan Carpenter
2012-06-22 13:32     ` Josef Bacik
2012-06-25 11:15       ` [patch v2] Btrfs: fix error handling in __add_reloc_root() Dan Carpenter
2012-06-25 13:41         ` Josef Bacik
2012-06-25 13:53           ` Dan Carpenter
2012-06-26  1:21             ` santosh prasad nayak
2012-06-26  6:41               ` Dan Carpenter

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).