aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/ipc_sysctl.c
diff options
context:
space:
mode:
authorAndrey Vagin <avagin@openvz.org>2014-10-13 18:54:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:18:22 -0400
commit1195d94e006b23c6292e78857e154872e33b6d7e (patch)
tree5ed72b5df3c9e85a844c743fcff2e364aa8186b7 /ipc/ipc_sysctl.c
parentc34d85aca91729596f876604e147892b81ecbbe9 (diff)
ipc: always handle a new value of auto_msgmni
proc_dointvec_minmax() returns zero if a new value has been set. So we don't need to check all charecters have been handled. Below you can find two examples. In the new value has not been handled properly. $ strace ./a.out open("/proc/sys/kernel/auto_msgmni", O_WRONLY) = 3 write(3, "0\n\0", 3) = 2 close(3) = 0 exit_group(0) $ cat /sys/kernel/debug/tracing/trace $strace ./a.out open("/proc/sys/kernel/auto_msgmni", O_WRONLY) = 3 write(3, "0\n", 2) = 2 close(3) = 0 $ cat /sys/kernel/debug/tracing/trace a.out-697 [000] .... 3280.998235: unregister_ipcns_notifier <-proc_ipcauto_dointvec_minmax Fixes: 9eefe520c814 ("ipc: do not use a negative value to re-enable msgmni automatic recomputin") Signed-off-by: Andrey Vagin <avagin@openvz.org> Cc: Mathias Krause <minipli@googlemail.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Joe Perches <joe@perches.com> Cc: Davidlohr Bueso <davidlohr@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/ipc_sysctl.c')
-rw-r--r--ipc/ipc_sysctl.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index c3f0326e98db..e8075b247497 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -123,7 +123,6 @@ static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write,
123 void __user *buffer, size_t *lenp, loff_t *ppos) 123 void __user *buffer, size_t *lenp, loff_t *ppos)
124{ 124{
125 struct ctl_table ipc_table; 125 struct ctl_table ipc_table;
126 size_t lenp_bef = *lenp;
127 int oldval; 126 int oldval;
128 int rc; 127 int rc;
129 128
@@ -133,7 +132,7 @@ static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write,
133 132
134 rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); 133 rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
135 134
136 if (write && !rc && lenp_bef == *lenp) { 135 if (write && !rc) {
137 int newval = *((int *)(ipc_table.data)); 136 int newval = *((int *)(ipc_table.data));
138 /* 137 /*
139 * The file "auto_msgmni" has correctly been set. 138 * The file "auto_msgmni" has correctly been set.