diff options
-rw-r--r-- | ipc/mqueue.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 96fb36cd9874..68eb857cfdea 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -52,6 +52,14 @@ | |||
52 | #define HARD_MSGMAX (131072/sizeof(void*)) | 52 | #define HARD_MSGMAX (131072/sizeof(void*)) |
53 | #define DFLT_MSGSIZEMAX 8192 /* max message size */ | 53 | #define DFLT_MSGSIZEMAX 8192 /* max message size */ |
54 | 54 | ||
55 | /* | ||
56 | * Define the ranges various user-specified maximum values can | ||
57 | * be set to. | ||
58 | */ | ||
59 | #define MIN_MSGMAX 1 /* min value for msg_max */ | ||
60 | #define MAX_MSGMAX HARD_MSGMAX /* max value for msg_max */ | ||
61 | #define MIN_MSGSIZEMAX 128 /* min value for msgsize_max */ | ||
62 | #define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */ | ||
55 | 63 | ||
56 | struct ext_wait_queue { /* queue of sleeping tasks */ | 64 | struct ext_wait_queue { /* queue of sleeping tasks */ |
57 | struct task_struct *task; | 65 | struct task_struct *task; |
@@ -134,8 +142,8 @@ static struct inode *mqueue_get_inode(struct super_block *sb, int mode, | |||
134 | info->qsize = 0; | 142 | info->qsize = 0; |
135 | info->user = NULL; /* set when all is ok */ | 143 | info->user = NULL; /* set when all is ok */ |
136 | memset(&info->attr, 0, sizeof(info->attr)); | 144 | memset(&info->attr, 0, sizeof(info->attr)); |
137 | info->attr.mq_maxmsg = DFLT_MSGMAX; | 145 | info->attr.mq_maxmsg = msg_max; |
138 | info->attr.mq_msgsize = DFLT_MSGSIZEMAX; | 146 | info->attr.mq_msgsize = msgsize_max; |
139 | if (attr) { | 147 | if (attr) { |
140 | info->attr.mq_maxmsg = attr->mq_maxmsg; | 148 | info->attr.mq_maxmsg = attr->mq_maxmsg; |
141 | info->attr.mq_msgsize = attr->mq_msgsize; | 149 | info->attr.mq_msgsize = attr->mq_msgsize; |
@@ -1191,11 +1199,11 @@ static struct file_system_type mqueue_fs_type = { | |||
1191 | .kill_sb = kill_litter_super, | 1199 | .kill_sb = kill_litter_super, |
1192 | }; | 1200 | }; |
1193 | 1201 | ||
1194 | static int msg_max_limit_min = DFLT_MSGMAX; | 1202 | static int msg_max_limit_min = MIN_MSGMAX; |
1195 | static int msg_max_limit_max = HARD_MSGMAX; | 1203 | static int msg_max_limit_max = MAX_MSGMAX; |
1196 | 1204 | ||
1197 | static int msg_maxsize_limit_min = DFLT_MSGSIZEMAX; | 1205 | static int msg_maxsize_limit_min = MIN_MSGSIZEMAX; |
1198 | static int msg_maxsize_limit_max = INT_MAX; | 1206 | static int msg_maxsize_limit_max = MAX_MSGSIZEMAX; |
1199 | 1207 | ||
1200 | static ctl_table mq_sysctls[] = { | 1208 | static ctl_table mq_sysctls[] = { |
1201 | { | 1209 | { |