linux-stable/samples
SeongJae Park d51b55f8c1 samples/damon/wsse: fix boot time enable handling
commit 0ed1165c37 upstream.

Patch series "mm/damon: fix misc bugs in DAMON modules".

From manual code review, I found below bugs in DAMON modules.

DAMON sample modules crash if those are enabled at boot time, via kernel
command line.  A similar issue was found and fixed on DAMON non-sample
modules in the past, but we didn't check that for sample modules.

DAMON non-sample modules are not setting 'enabled' parameters accordingly
when real enabling is failed.  Honggyu found and fixed[1] this type of
bugs in DAMON sample modules, and my inspection was motivated by the great
work.  Kudos to Honggyu.

Finally, DAMON_RECLIAM is mistakenly losing scheme internal status due to
misuse of damon_commit_ctx().  DAMON_LRU_SORT has a similar misuse, but
fortunately it is not causing real status loss.

Fix the bugs.  Since these are similar patterns of bugs that were found in
the past, it would be better to add tests or refactor the code, in future.


This patch (of 6):

If 'enable' parameter of the 'wsse' 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-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20250706193207.39810-2-sj@kernel.org
Link: https://lore.kernel.org/20250702000205.1921-1-honggyu.kim@sk.com [1]
Fixes: b757c6cfc6 ("samples/damon/wsse: start and stop DAMON as the user requests")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-20 18:36:27 +02:00
..
acrn
auxdisplay
binderfs
bpf samples/bpf: Fix compilation failure for samples/bpf on LoongArch Fedora 2025-04-25 09:32:02 -07:00
cgroup
check-exec
configfs
connector treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
coresight
damon samples/damon/wsse: fix boot time enable handling 2025-08-20 18:36:27 +02:00
fanotify
fprobe
ftrace tracing: samples: Initialize trace_array_printk() with the correct function 2025-05-12 13:07:22 -04:00
hid
hidraw
hung_task
hw_breakpoint
kdb
kfifo
kmemleak
kobject
kprobes
landlock
livepatch samples/livepatch: add module descriptions 2025-04-11 17:32:38 -07:00
mei samples: mei: Fix building on musl libc 2025-08-15 12:16:22 +02:00
nitro_enclaves
pfsm
pidfd
pktgen
qmi
rpmsg
rust Char/Misc/IIO driver updates for 6.15-rc1 2025-04-01 11:26:08 -07:00
seccomp
timers
trace_events tracing: Verify event formats that have "%*p.." 2025-04-02 09:51:26 -04:00
trace_printk
uhid
user_events
v4l
vfio-mdev
vfs
watch_queue
watchdog
Kconfig
Makefile