]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Btrfs: fix inode leak on kmalloc failure in tree-log.c
authorFilipe David Borba Manana <fdmanana@gmail.com>
Sun, 4 Aug 2013 18:58:57 +0000 (19:58 +0100)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:04:53 +0000 (08:04 -0400)
In tree-log.c:replay_one_name(), if memory allocation for
the name fails, ensure we iput the dir inode we got before
before we return.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/tree-log.c

index ff60d8978ae264d95709d83342e1c309113521f0..6797a931cf6229a3007491faaac99cbdf770a3d4 100644 (file)
@@ -1536,8 +1536,10 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
 
        name_len = btrfs_dir_name_len(eb, di);
        name = kmalloc(name_len, GFP_NOFS);
-       if (!name)
-               return -ENOMEM;
+       if (!name) {
+               ret = -ENOMEM;
+               goto out;
+       }
 
        log_type = btrfs_dir_type(eb, di);
        read_extent_buffer(eb, name, (unsigned long)(di + 1),