]> git.hungrycats.org Git - linux/commit
Btrfs: use kmem_cache_free when freeing entry in inode cache
authorFilipe Manana <fdmanana@suse.com>
Fri, 12 Jun 2015 08:35:35 +0000 (09:35 +0100)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Sat, 4 Jul 2015 02:00:11 +0000 (22:00 -0400)
commit0dc4c57e98379c034e37280e94bde75ef572b1ce
tree68c1059d555aa98244fafa3a1bbec95db73dd597
parent05c4e0c613165564c12e07ca0adf08944d405ce4
Btrfs: use kmem_cache_free when freeing entry in inode cache

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().

Cc: stable@vger.kernel.org
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
(cherry picked from commit af6bf76d1de143a38c919572462899e9f1fc477f)
fs/btrfs/inode-map.c