]> www.infradead.org Git - users/dwmw2/linux.git/commit
xfs: use kmem_cache_free() for kmem_cache objects
authorRustam Kovhaev <rkovhaev@gmail.com>
Mon, 27 Jun 2022 06:51:36 +0000 (09:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Jul 2022 14:39:23 +0000 (16:39 +0200)
commitdb3f8110c3b0e1185f6288331cb428978708fb79
tree35fefda412c8c5285f6e33e659ecbc0a4f8c9ced
parent09c9902cd80a07c2e69024f96f049985047e64b8
xfs: use kmem_cache_free() for kmem_cache objects

commit c30a0cbd07ecc0eec7b3cd568f7b1c7bb7913f93 upstream.

For kmalloc() allocations SLOB prepends the blocks with a 4-byte header,
and it puts the size of the allocated blocks in that header.
Blocks allocated with kmem_cache_alloc() allocations do not have that
header.

SLOB explodes when you allocate memory with kmem_cache_alloc() and then
try to free it with kfree() instead of kmem_cache_free().
SLOB will assume that there is a header when there is none, read some
garbage to size variable and corrupt the adjacent objects, which
eventually leads to hang or panic.

Let's make XFS work with SLOB by using proper free function.

Fixes: 9749fee83f38 ("xfs: enable the xfs_defer mechanism to process extents to free")
Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_extfree_item.c