diff options
author | Honggyu Kim <honggyu.kim@sk.com> | 2025-07-02 09:02:03 +0900 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2025-07-09 21:07:55 -0700 |
commit | ddba1b6cf4791824f8b614ff8878353a6c6f79f5 (patch) | |
tree | 7eb350b6a0fdf83c1e80cfc62ceadd46809625bd | |
parent | f1221c8442616a6927aff836327777144545cb29 (diff) |
samples/damon: fix damon sample mtier for start failure
The damon_sample_mtier_start() can fail so we must reset the "enable"
parameter to "false" again for proper rollback.
In such cases, setting Y to "enable" then N triggers the similar crash
with mtier because damon sample start failed but the "enable" stays as Y.
Link: https://lkml.kernel.org/r/20250702000205.1921-4-honggyu.kim@sk.com
Fixes: 82a08bde3cf7 ("samples/damon: implement a DAMON module for memory tiering")
Signed-off-by: Honggyu Kim <honggyu.kim@sk.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r-- | samples/damon/mtier.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/samples/damon/mtier.c b/samples/damon/mtier.c index 36d2cd933f5a..c94254b77fc9 100644 --- a/samples/damon/mtier.c +++ b/samples/damon/mtier.c @@ -164,8 +164,12 @@ static int damon_sample_mtier_enable_store( if (enable == enabled) return 0; - if (enable) - return damon_sample_mtier_start(); + if (enable) { + err = damon_sample_mtier_start(); + if (err) + enable = false; + return err; + } damon_sample_mtier_stop(); return 0; } |