The patch titled fs/btrfs/inode.c: eliminate memory leak has been removed from the -mm tree. Its filename was fs-btrfs-inodec-eliminate-memory-leak.patch This patch was dropped because a suckier fix was merged The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: fs/btrfs/inode.c: eliminate memory leak From: Julia Lawall <julia@xxxxxxx> This code is preceded by a call to btrfs_alloc_path, which allocates some memory. There is some error handling code at the end of the function that frees it, that can be taken advantage of with a little ordering adjustment. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // <smpl> @r exists@ local idexpression x; expression E; identifier f1; iterator I; @@ x = btrfs_alloc_path(...); <... when != x when != true (x == NULL || ...) when != if (...) { <+...x...+> } when != I (...) { <+...x...+> } ( x == NULL | x == E | x->f1 ) ...> * return ...; // </smpl> Signed-off-by: Julia Lawall <julia@xxxxxxx> Cc: Chris Mason <chris.mason@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/btrfs/inode.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff -puN fs/btrfs/inode.c~fs-btrfs-inodec-eliminate-memory-leak fs/btrfs/inode.c --- a/fs/btrfs/inode.c~fs-btrfs-inodec-eliminate-memory-leak +++ a/fs/btrfs/inode.c @@ -4527,17 +4527,17 @@ static struct inode *btrfs_new_inode(str BUG_ON(!path); inode = new_inode(root->fs_info->sb); - if (!inode) - return ERR_PTR(-ENOMEM); + if (!inode) { + ret = -ENOMEM; + goto fail_path; + } if (dir) { trace_btrfs_inode_request(dir); ret = btrfs_set_inode_index(dir, index); - if (ret) { - iput(inode); - return ERR_PTR(ret); - } + if (ret) + goto fail_inode; } /* * index_cnt is ignored for everything but a dir, @@ -4615,8 +4615,10 @@ static struct inode *btrfs_new_inode(str fail: if (dir) BTRFS_I(dir)->index_cnt--; - btrfs_free_path(path); +fail_inode: iput(inode); +fail_path: + btrfs_free_path(path); return ERR_PTR(ret); } _ Patches currently in -mm which might be from julia@xxxxxxx are linux-next.patch drivers-rtc-rtc-mrstc-use-release_mem_region-after-request_mem_region.patch drivers-rtc-rtc-mrstc-use-release_mem_region-after-request_mem_region-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html