lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250706184750.36588-1-sj@kernel.org>
Date: Sun,  6 Jul 2025 11:47:50 -0700
From: SeongJae Park <sj@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: SeongJae Park <sj@...nel.org>,
	damon@...ts.linux.dev,
	kernel-team@...a.com,
	linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: [PATCH mm-unstable] mm/damon/stat: reset enabled when DAMON start failed

When damon_stat_start() fails, 'enabled' parameter is not reset.  As a
result, users show the parameter 'Y' while it is not really working.
Fix it by resetting 'enabled' to 'false' when damon_stat_start() failed.

Fixes: 00e74895aba3 ("mm/damon: introduce DAMON_STAT module") # mm-unstable
Signed-off-by: SeongJae Park <sj@...nel.org>
---
 mm/damon/stat.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/mm/damon/stat.c b/mm/damon/stat.c
index c35bd1852f0b..b75af871627e 100644
--- a/mm/damon/stat.c
+++ b/mm/damon/stat.c
@@ -225,8 +225,12 @@ static int damon_stat_enabled_store(
 		 */
 		return 0;
 
-	if (enabled)
-		return damon_stat_start();
+	if (enabled) {
+		err = damon_stat_start();
+		if (err)
+			enabled = false;
+		return err;
+	}
 	damon_stat_stop();
 	return 0;
 }
@@ -240,6 +244,9 @@ static int __init damon_stat_init(void)
 	/* probably set via command line */
 	if (enabled)
 		err = damon_stat_start();
+
+	if (err && enabled)
+		enabled = false;
 	return err;
 }
 

base-commit: 93a51997eb1dda993197a9f82602b96d56056ce4
-- 
2.39.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ