diff mbox

Btrfs: fix fspath error deallocation

Message ID 1462884980-10052-1-git-send-email-vincent.stehle@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Vincent Stehlé May 10, 2016, 12:56 p.m. UTC
Make sure to deallocate fspath with vfree() in case of error in
init_ipath().

fspath is allocated with vmalloc() in init_data_container() since
commit 425d17a290c0 ("Btrfs: use larger limit for translation of logical to
inode").

Signed-off-by: Vincent Stehlé <vincent.stehle@intel.com>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
---
 fs/btrfs/backref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba May 10, 2016, 1:39 p.m. UTC | #1
On Tue, May 10, 2016 at 02:56:20PM +0200, Vincent Stehlé wrote:
> Make sure to deallocate fspath with vfree() in case of error in
> init_ipath().
> 
> fspath is allocated with vmalloc() in init_data_container() since
> commit 425d17a290c0 ("Btrfs: use larger limit for translation of logical to
> inode").
> 
> Signed-off-by: Vincent Stehlé <vincent.stehle@intel.com>
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <jbacik@fb.com>
> Cc: David Sterba <dsterba@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 80e8472..d309018 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1991,7 +1991,7 @@  struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root,
 
 	ifp = kmalloc(sizeof(*ifp), GFP_NOFS);
 	if (!ifp) {
-		kfree(fspath);
+		vfree(fspath);
 		return ERR_PTR(-ENOMEM);
 	}