From: Filipe David Borba Manana Date: Sun, 4 Aug 2013 18:58:57 +0000 (+0100) Subject: Btrfs: fix inode leak on kmalloc failure in tree-log.c X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2bac325ea8f117636e6601e66a67d2df58974610;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git Btrfs: fix inode leak on kmalloc failure in tree-log.c 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 Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index ff60d8978ae2..6797a931cf62 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -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),