linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipc: Limit sysctl value to IPCMNI
@ 2018-06-08 13:49 Takashi Iwai
  2018-06-08 21:16 ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2018-06-08 13:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Davidlohr Bueso, linux-kernel

Currently shmmni proc entry accepts all entered integer values, but
the practical limit is IPCMNI (32768).  This confuses user as if a
bigger value were accepted but not applied correctly.

This patch changes the proc entry to use *_minmax variant to limit the
accepted values accordingly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 ipc/ipc_sysctl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index 8ad93c29f511..0c8f89f54e61 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -99,6 +99,7 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,
 static int zero;
 static int one = 1;
 static int int_max = INT_MAX;
+static int ipcmni = IPCMNI;
 
 static struct ctl_table ipc_kern_table[] = {
 	{
@@ -120,7 +121,9 @@ static struct ctl_table ipc_kern_table[] = {
 		.data		= &init_ipc_ns.shm_ctlmni,
 		.maxlen		= sizeof(init_ipc_ns.shm_ctlmni),
 		.mode		= 0644,
-		.proc_handler	= proc_ipc_dointvec,
+		.proc_handler	= proc_ipc_dointvec_minmax,
+		.extra1		= &zero,
+		.extra2		= &ipcmni,
 	},
 	{
 		.procname	= "shm_rmid_forced",
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-06-18 21:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 13:49 [PATCH] ipc: Limit sysctl value to IPCMNI Takashi Iwai
2018-06-08 21:16 ` Andrew Morton
2018-06-09  6:48   ` Takashi Iwai
2018-06-11 23:18     ` Andrew Morton
2018-06-12  6:36       ` Takashi Iwai
2018-06-12 23:36         ` Andrew Morton
2018-06-18  5:27           ` Waiman Long
2018-06-18 21:51             ` Andrew Morton
2018-06-11 21:27   ` Waiman Long
2018-06-12  6:31     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).