Thread (9 messages) 9 messages, 3 authors, 2012-06-26

Re: [patch v2] Btrfs: fix error handling in __add_reloc_root()

From: santosh prasad nayak <hidden>
Date: 2012-06-26 01:21:40
Also in: linux-btrfs

I am also facing similar issue while applying this patch.

[santosh@localhost linux-next]$ sudo git am mail_Dan.txt
Patch format detection failed.
[santosh@localhost linux-next]$




regards
santosh

On Mon, Jun 25, 2012 at 7:23 PM, Dan Carpenter [off-list ref] wrote:
On Mon, Jun 25, 2012 at 09:41:12AM -0400, Josef Bacik wrote:
quoted
On Mon, Jun 25, 2012 at 05:15:23AM -0600, Dan Carpenter wrote:
quoted
We dereferenced "node" in the error message after freeing it.  Also
btrfs_panic() can return so we should return an error code instead of
continuing.

Signed-off-by: Dan Carpenter <redacted>
---
v2: in the first version I just deleted the kfree().
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 790f492..4da0865 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1239,10 +1239,11 @@ 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);
+           kfree(node);
+           return -EEXIST;
    }

    list_add_tail(&root->root_list, &rc->reloc_roots);
I'm not sure why but it seems like this patch is wrapped.  At first I thought it
was thunderbird but then I opened it up and saved it from mutt and I got the
same problem.  I will fix it up, but you may want to check your mail client.
The message that went through to kernel-janitors applies fine for
me.  I'm not sure what to say.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help