aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mq_sysctl.c18
-rw-r--r--ipc/mqueue.c6
2 files changed, 15 insertions, 9 deletions
diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c
index 383d638340b8..5bb8bfe67149 100644
--- a/ipc/mq_sysctl.c
+++ b/ipc/mq_sysctl.c
@@ -22,6 +22,16 @@ static void *get_mq(ctl_table *table)
22 return which; 22 return which;
23} 23}
24 24
25static int proc_mq_dointvec(ctl_table *table, int write,
26 void __user *buffer, size_t *lenp, loff_t *ppos)
27{
28 struct ctl_table mq_table;
29 memcpy(&mq_table, table, sizeof(mq_table));
30 mq_table.data = get_mq(table);
31
32 return proc_dointvec(&mq_table, write, buffer, lenp, ppos);
33}
34
25static int proc_mq_dointvec_minmax(ctl_table *table, int write, 35static int proc_mq_dointvec_minmax(ctl_table *table, int write,
26 void __user *buffer, size_t *lenp, loff_t *ppos) 36 void __user *buffer, size_t *lenp, loff_t *ppos)
27{ 37{
@@ -33,12 +43,10 @@ static int proc_mq_dointvec_minmax(ctl_table *table, int write,
33 lenp, ppos); 43 lenp, ppos);
34} 44}
35#else 45#else
46#define proc_mq_dointvec NULL
36#define proc_mq_dointvec_minmax NULL 47#define proc_mq_dointvec_minmax NULL
37#endif 48#endif
38 49
39static int msg_queues_limit_min = MIN_QUEUESMAX;
40static int msg_queues_limit_max = HARD_QUEUESMAX;
41
42static int msg_max_limit_min = MIN_MSGMAX; 50static int msg_max_limit_min = MIN_MSGMAX;
43static int msg_max_limit_max = HARD_MSGMAX; 51static int msg_max_limit_max = HARD_MSGMAX;
44 52
@@ -51,9 +59,7 @@ static ctl_table mq_sysctls[] = {
51 .data = &init_ipc_ns.mq_queues_max, 59 .data = &init_ipc_ns.mq_queues_max,
52 .maxlen = sizeof(int), 60 .maxlen = sizeof(int),
53 .mode = 0644, 61 .mode = 0644,
54 .proc_handler = proc_mq_dointvec_minmax, 62 .proc_handler = proc_mq_dointvec,
55 .extra1 = &msg_queues_limit_min,
56 .extra2 = &msg_queues_limit_max,
57 }, 63 },
58 { 64 {
59 .procname = "msg_max", 65 .procname = "msg_max",
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index ccf1f9fd263a..c3b31179122c 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -433,9 +433,9 @@ static int mqueue_create(struct inode *dir, struct dentry *dentry,
433 error = -EACCES; 433 error = -EACCES;
434 goto out_unlock; 434 goto out_unlock;
435 } 435 }
436 if (ipc_ns->mq_queues_count >= HARD_QUEUESMAX || 436
437 (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && 437 if (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max &&
438 !capable(CAP_SYS_RESOURCE))) { 438 !capable(CAP_SYS_RESOURCE)) {
439 error = -ENOSPC; 439 error = -ENOSPC;
440 goto out_unlock; 440 goto out_unlock;
441 } 441 }