samples/damon/mtier: support boot time enable setup
authorSeongJae Park <sj@kernel.org>
Sun, 6 Jul 2025 19:32:04 +0000 (12:32 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 13 Jul 2025 23:38:34 +0000 (16:38 -0700)
commit964314344eab7bc43e38a32be281c5ea0609773b
treed7185e883626987e450e6e4cc11ec056c80e5a7f
parent2780505ec2b42c07853b34640bc63279ac2bb53b
samples/damon/mtier: support boot time enable setup

If 'enable' parameter of the 'mtier' DAMON sample module is set at boot
time via the kernel command line, memory allocation is tried before the
slab is initialized.  As a result kernel NULL pointer dereference BUG can
happen.  Fix it by checking the initialization status.

Link: https://lkml.kernel.org/r/20250706193207.39810-4-sj@kernel.org
Fixes: 82a08bde3cf7 ("samples/damon: implement a DAMON module for memory tiering")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
samples/damon/mtier.c