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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 29 Apr 2012 08:45:32 +0200
From:	Sasha Levin <levinsasha928@...il.com>
To:	viro@...iv.linux.org.uk, rostedt@...dmis.org, fweisbec@...il.com,
	mingo@...hat.com, a.p.zijlstra@...llo.nl, paulus@...ba.org,
	acme@...stprotocols.net, james.l.morris@...cle.com,
	ebiederm@...ssion.com, akpm@...ux-foundation.org,
	tglx@...utronix.de
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, linux-security-module@...r.kernel.org,
	Sasha Levin <levinsasha928@...il.com>
Subject: [PATCH 09/14] perf,sysctl: remove proc input checks out of sysctl handlers

Simplify sysctl handler by removing user input checks and using the callback
provided by the sysctl table.

Signed-off-by: Sasha Levin <levinsasha928@...il.com>
---
 include/linux/perf_event.h |    4 +---
 kernel/events/core.c       |    9 +--------
 kernel/sysctl.c            |    3 ++-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ddbb6a9..24c3a54 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1244,9 +1244,7 @@ extern int sysctl_perf_event_paranoid;
 extern int sysctl_perf_event_mlock;
 extern int sysctl_perf_event_sample_rate;
 
-extern int perf_proc_update_handler(struct ctl_table *table, int write,
-		void __user *buffer, size_t *lenp,
-		loff_t *ppos);
+extern int perf_proc_update_handler(void);
 
 static inline bool perf_paranoid_tracepoint_raw(void)
 {
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 32cfc76..94d126f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -167,15 +167,8 @@ int sysctl_perf_event_sample_rate __read_mostly = DEFAULT_MAX_SAMPLE_RATE;
 static int max_samples_per_tick __read_mostly =
 	DIV_ROUND_UP(DEFAULT_MAX_SAMPLE_RATE, HZ);
 
-int perf_proc_update_handler(struct ctl_table *table, int write,
-		void __user *buffer, size_t *lenp,
-		loff_t *ppos)
+int perf_proc_update_handler(void)
 {
-	int ret = proc_dointvec(table, write, buffer, lenp, ppos);
-
-	if (ret || !write)
-		return ret;
-
 	max_samples_per_tick = DIV_ROUND_UP(sysctl_perf_event_sample_rate, HZ);
 
 	return 0;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 16252c9..eef7508 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -977,7 +977,8 @@ static struct ctl_table kern_table[] = {
 		.data		= &sysctl_perf_event_sample_rate,
 		.maxlen		= sizeof(sysctl_perf_event_sample_rate),
 		.mode		= 0644,
-		.proc_handler	= perf_proc_update_handler,
+		.proc_handler	= proc_dointvec,
+		.callback	= perf_proc_update_handler,
 	},
 #endif
 #ifdef CONFIG_KMEMCHECK
-- 
1.7.8.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ