From 82ccb03c5af4c8589176d8497ff20df6800fb79b Mon Sep 17 00:00:00 2001 From: Joe Korty Date: Sat, 18 Oct 2008 20:28:32 -0700 Subject: [PATCH] --- yaml --- r: 115955 b: refs/heads/master c: b231cca4381ee15ec99afbfb244fbc0324869927 h: refs/heads/master i: 115953: 181e0028ff37ee8813cad60c5933a0b44c8bbdda 115951: a0ef2e3621af6320ccbac895f7eecbe697f2beb6 v: v3 --- [refs] | 2 +- trunk/ipc/mqueue.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 7b3f39820ec3..cdadc522ec88 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: acd99dbf54020f5c80b9aa2f2ea86f43cb285b02 +refs/heads/master: b231cca4381ee15ec99afbfb244fbc0324869927 diff --git a/trunk/ipc/mqueue.c b/trunk/ipc/mqueue.c index 96fb36cd9874..68eb857cfdea 100644 --- a/trunk/ipc/mqueue.c +++ b/trunk/ipc/mqueue.c @@ -52,6 +52,14 @@ #define HARD_MSGMAX (131072/sizeof(void*)) #define DFLT_MSGSIZEMAX 8192 /* max message size */ +/* + * Define the ranges various user-specified maximum values can + * be set to. + */ +#define MIN_MSGMAX 1 /* min value for msg_max */ +#define MAX_MSGMAX HARD_MSGMAX /* max value for msg_max */ +#define MIN_MSGSIZEMAX 128 /* min value for msgsize_max */ +#define MAX_MSGSIZEMAX (8192*128) /* max value for msgsize_max */ struct ext_wait_queue { /* queue of sleeping tasks */ struct task_struct *task; @@ -134,8 +142,8 @@ static struct inode *mqueue_get_inode(struct super_block *sb, int mode, info->qsize = 0; info->user = NULL; /* set when all is ok */ memset(&info->attr, 0, sizeof(info->attr)); - info->attr.mq_maxmsg = DFLT_MSGMAX; - info->attr.mq_msgsize = DFLT_MSGSIZEMAX; + info->attr.mq_maxmsg = msg_max; + info->attr.mq_msgsize = msgsize_max; if (attr) { info->attr.mq_maxmsg = attr->mq_maxmsg; info->attr.mq_msgsize = attr->mq_msgsize; @@ -1191,11 +1199,11 @@ static struct file_system_type mqueue_fs_type = { .kill_sb = kill_litter_super, }; -static int msg_max_limit_min = DFLT_MSGMAX; -static int msg_max_limit_max = HARD_MSGMAX; +static int msg_max_limit_min = MIN_MSGMAX; +static int msg_max_limit_max = MAX_MSGMAX; -static int msg_maxsize_limit_min = DFLT_MSGSIZEMAX; -static int msg_maxsize_limit_max = INT_MAX; +static int msg_maxsize_limit_min = MIN_MSGSIZEMAX; +static int msg_maxsize_limit_max = MAX_MSGSIZEMAX; static ctl_table mq_sysctls[] = { {