diff options
| author | Akinobu Mita <[email protected]> | 2025-09-20 13:25:46 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-09-25 23:10:35 +0000 |
| commit | 06195ee967d06ead757f9291bbaf1a0b30fa10b8 (patch) | |
| tree | 32d83eebf378a6df2295e7d1b5e408fa5141c459 | |
| parent | mailmap: add entry for Bence Csókás (diff) | |
| download | kernel-06195ee967d06ead757f9291bbaf1a0b30fa10b8.tar.gz kernel-06195ee967d06ead757f9291bbaf1a0b30fa10b8.zip | |
mm/damon/sysfs: do not ignore callback's return value in damon_sysfs_damon_call()
The callback return value is ignored in damon_sysfs_damon_call(), which
means that it is not possible to detect invalid user input when writing
commands such as 'commit' to
/sys/kernel/mm/damon/admin/kdamonds/<K>/state. Fix it.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: f64539dcdb87 ("mm/damon/sysfs: use damon_call() for update_schemes_stats")
Signed-off-by: Akinobu Mita <[email protected]>
Reviewed-by: SeongJae Park <[email protected]>
Cc: <[email protected]> [6.14+]
Signed-off-by: Andrew Morton <[email protected]>
| -rw-r--r-- | mm/damon/sysfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index c96c2154128f..7308dee97b21 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1592,12 +1592,14 @@ static int damon_sysfs_damon_call(int (*fn)(void *data), struct damon_sysfs_kdamond *kdamond) { struct damon_call_control call_control = {}; + int err; if (!kdamond->damon_ctx) return -EINVAL; call_control.fn = fn; call_control.data = kdamond; - return damon_call(kdamond->damon_ctx, &call_control); + err = damon_call(kdamond->damon_ctx, &call_control); + return err ? err : call_control.return_code; } struct damon_sysfs_schemes_walk_data { |
