[PATCH 17/18] btrfs: add NULL check for build_backref_tree()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Miao Xie <miaox@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux