[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-btrfs
Subject:    [PATCH 17/18] btrfs: add NULL check for build_backref_tree()
From:       Miao Xie <miaox () cn ! fujitsu ! com>
Date:       2010-03-25 12:37:42
Message-ID: 4BAB5916.2030206 () cn ! fujitsu ! com
[Download RAW message or body]

From: Miao Xie <miaox@cn.fujitsu.com>

if passing NULL to btrfs_free_path(),oops will happen. so we must check the
pointer passed to it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/relocation.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 0b23942..6737803 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -816,8 +816,10 @@ next:
 			list_add_tail(&edge->list[UPPER], &list);
 	}
 out:
-	btrfs_free_path(path1);
-	btrfs_free_path(path2);
+	if (path1)
+		btrfs_free_path(path1);
+	if (path2)
+		btrfs_free_path(path2);
 	if (err) {
 		INIT_LIST_HEAD(&list);
 		upper = node;
-- 
1.6.5.2


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic