diff options
author | Filipe Manana <fdmanana@suse.com> | 2015-06-13 08:52:56 +0300 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2015-07-20 16:38:50 +0300 |
commit | 660fe0d6a207e356f5595ad01c51237a79c1e6fe (patch) | |
tree | 6aafa713dfdd4c2fca8b0b9ed8a102726ca77c11 /fs/btrfs | |
parent | 08e5cda96e0d7190809a59eec2d327ef95e60885 (diff) | |
download | linux-660fe0d6a207e356f5595ad01c51237a79c1e6fe.tar.xz |
Btrfs: use kmem_cache_free when freeing entry in inode cache
commit c3f4a1685bb87e59c886ee68f7967eae07d4dffa upstream.
The free space entries are allocated using kmem_cache_zalloc(),
through __btrfs_add_free_space(), therefore we should use
kmem_cache_free() and not kfree() to avoid any confusion and
any potential problem. Looking at the kfree() definition at
mm/slab.c it has the following comment:
/*
* (...)
*
* Don't free memory not originally allocated by kmalloc()
* or you will run into trouble.
*/
So better be safe and use kmem_cache_free().
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode-map.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index 888fbe19079f..f25c68d84811 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -271,7 +271,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) __btrfs_add_free_space(ctl, info->offset, count); free: rb_erase(&info->offset_index, rbroot); - kfree(info); + kmem_cache_free(btrfs_free_space_cachep, info); } } |