Source
81
81
82
82
memcpy(&ipc_table, table, sizeof(ipc_table));
83
83
ipc_table.data = &dummy;
84
84
85
85
if (write)
86
86
pr_info_once("writing to auto_msgmni has no effect");
87
87
88
88
return proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
89
89
}
90
90
91
+
static int proc_ipc_sem_dointvec(struct ctl_table *table, int write,
92
+
void __user *buffer, size_t *lenp, loff_t *ppos)
93
+
{
94
+
int ret, semmni;
95
+
struct ipc_namespace *ns = current->nsproxy->ipc_ns;
96
+
97
+
semmni = ns->sem_ctls[3];
98
+
ret = proc_ipc_dointvec(table, write, buffer, lenp, ppos);
99
+
100
+
if (!ret)
101
+
ret = sem_check_semmni(current->nsproxy->ipc_ns);
102
+
103
+
/*
104
+
* Reset the semmni value if an error happens.
105
+
*/
106
+
if (ret)
107
+
ns->sem_ctls[3] = semmni;
108
+
return ret;
109
+
}
110
+
91
111
#else
92
112
#define proc_ipc_doulongvec_minmax NULL
93
113
#define proc_ipc_dointvec NULL
94
114
#define proc_ipc_dointvec_minmax NULL
95
115
#define proc_ipc_dointvec_minmax_orphans NULL
96
116
#define proc_ipc_auto_msgmni NULL
117
+
#define proc_ipc_sem_dointvec NULL
97
118
#endif
98
119
99
120
static int zero;
100
121
static int one = 1;
101
122
static int int_max = INT_MAX;
102
123
static int ipc_mni = IPCMNI;
103
124
104
125
static struct ctl_table ipc_kern_table[] = {
105
126
{
106
127
.procname = "shmmax",
168
189
.mode = 0644,
169
190
.proc_handler = proc_ipc_dointvec_minmax,
170
191
.extra1 = &zero,
171
192
.extra2 = &int_max,
172
193
},
173
194
{
174
195
.procname = "sem",
175
196
.data = &init_ipc_ns.sem_ctls,
176
197
.maxlen = 4*sizeof(int),
177
198
.mode = 0644,
178
-
.proc_handler = proc_ipc_dointvec,
199
+
.proc_handler = proc_ipc_sem_dointvec,
179
200
},
180
201
#ifdef CONFIG_CHECKPOINT_RESTORE
181
202
{
182
203
.procname = "sem_next_id",
183
204
.data = &init_ipc_ns.ids[IPC_SEM_IDS].next_id,
184
205
.maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id),
185
206
.mode = 0644,
186
207
.proc_handler = proc_ipc_dointvec_minmax,
187
208
.extra1 = &zero,
188
209
.extra2 = &int_max,