Skip to content

Commit f1221c8

Browse files
honggyukimakpm00
authored andcommitted
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/[email protected] Fixes: b757c6c ("samples/damon/wsse: start and stop DAMON as the user requests") Signed-off-by: Honggyu Kim <[email protected]> Reviewed-by: SeongJae Park <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent d9e01c6 commit f1221c8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

samples/damon/wsse.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ static int damon_sample_wsse_enable_store(
102102
if (enable == enabled)
103103
return 0;
104104

105-
if (enable)
106-
return damon_sample_wsse_start();
105+
if (enable) {
106+
err = damon_sample_wsse_start();
107+
if (err)
108+
enable = false;
109+
return err;
110+
}
107111
damon_sample_wsse_stop();
108112
return 0;
109113
}

0 commit comments

Comments
 (0)