[PATCH 05/17] btrfs-progs: avoid double-free in __btrfs_map_block

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

 



__btrfs_map_block() can possibly do the goto again: loop after
having allocated & freed the "multi" pointer.  There are then
a couple error conditions where it will attempt to again kfree
the now non-NULL multi pointer.  So before retrying, reset
multi to NULL after we free it.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
 volumes.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/volumes.c b/volumes.c
index c8fbde3..ca1b402 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1226,6 +1226,7 @@ again:
 	if (multi_ret && stripes_allocated < stripes_required) {
 		stripes_allocated = stripes_required;
 		kfree(multi);
+		multi = NULL;
 		goto again;
 	}
 	stripe_nr = offset;
-- 
1.7.1

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