summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHonggyu Kim <honggyu.kim@sk.com>2025-07-02 03:02:02 +0300
committerAndrew Morton <akpm@linux-foundation.org>2025-07-10 07:07:55 +0300
commitf1221c8442616a6927aff836327777144545cb29 (patch)
tree61fe7a02d1ef2518052e0e11f2d956f86afb2b3e
parentd9e01c62b7a0c258a7481c083f84c766a8f5597c (diff)
downloadlinux-f1221c8442616a6927aff836327777144545cb29.tar.xz
samples/damon: fix damon sample wsse for start failure
The damon_sample_wsse_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 wsse because damon sample start failed but the "enable" stays as Y. Link: https://lkml.kernel.org/r/20250702000205.1921-3-honggyu.kim@sk.com Fixes: b757c6cfc696 ("samples/damon/wsse: start and stop DAMON as the user requests") 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/wsse.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/samples/damon/wsse.c b/samples/damon/wsse.c
index 11be25803274..e20238a249e7 100644
--- a/samples/damon/wsse.c
+++ b/samples/damon/wsse.c
@@ -102,8 +102,12 @@ static int damon_sample_wsse_enable_store(
if (enable == enabled)
return 0;
- if (enable)
- return damon_sample_wsse_start();
+ if (enable) {
+ err = damon_sample_wsse_start();
+ if (err)
+ enable = false;
+ return err;
+ }
damon_sample_wsse_stop();
return 0;
}