]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm: slub: call WARN() when detecting a slab corruption
authorHyesoo Yu <hyesoo.yu@samsung.com>
Sat, 6 Sep 2025 21:25:28 +0000 (17:25 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:58:21 +0000 (18:58 +0200)
commitd06b739f41dccb45c06972b4de46fc856d7411a9
tree8a09d3cb3e1109921e9b5df814c6dc558b4960a7
parent20a54a8db4dd85a30e2005081ab386f0c4cb3d3d
mm: slub: call WARN() when detecting a slab corruption

[ Upstream commit 3f6f32b14ab35452d2ed52f7821cf2829923c98d ]

If a slab object is corrupted or an error occurs in its internal
validation, continuing after restoration may cause other side effects.
At this point, it is difficult to debug because the problem occurred in
the past. It is useful to use WARN() to catch errors at the point of
issue because WARN() could trigger panic for system debugging when
panic_on_warn is enabled. WARN() is added where to detect the error on
slab_err and object_err.

It makes sense to only do the WARN() after printing the logs. slab_err
is splited to __slab_err that calls the WARN() and it is called after
printing logs.

Signed-off-by: Hyesoo Yu <hyesoo.yu@samsung.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Stable-dep-of: b4efccec8d06 ("mm/slub: avoid accessing metadata when pointer is invalid in object_err()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/slub.c