diff options
-rw-r--r-- | ipc/mqueue.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index b103022179a3..6e10a55a78c5 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -301,8 +301,9 @@ static int mqueue_create(struct inode *dir, struct dentry *dentry, | |||
301 | error = -EACCES; | 301 | error = -EACCES; |
302 | goto out_unlock; | 302 | goto out_unlock; |
303 | } | 303 | } |
304 | if (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && | 304 | if (ipc_ns->mq_queues_count >= HARD_QUEUESMAX || |
305 | !capable(CAP_SYS_RESOURCE)) { | 305 | (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && |
306 | !capable(CAP_SYS_RESOURCE))) { | ||
306 | error = -ENOSPC; | 307 | error = -ENOSPC; |
307 | goto out_unlock; | 308 | goto out_unlock; |
308 | } | 309 | } |
@@ -589,7 +590,8 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr) | |||
589 | if (attr->mq_maxmsg <= 0 || attr->mq_msgsize <= 0) | 590 | if (attr->mq_maxmsg <= 0 || attr->mq_msgsize <= 0) |
590 | return 0; | 591 | return 0; |
591 | if (capable(CAP_SYS_RESOURCE)) { | 592 | if (capable(CAP_SYS_RESOURCE)) { |
592 | if (attr->mq_maxmsg > HARD_MSGMAX) | 593 | if (attr->mq_maxmsg > HARD_MSGMAX || |
594 | attr->mq_msgsize > HARD_MSGSIZEMAX) | ||
593 | return 0; | 595 | return 0; |
594 | } else { | 596 | } else { |
595 | if (attr->mq_maxmsg > ipc_ns->mq_msg_max || | 597 | if (attr->mq_maxmsg > ipc_ns->mq_msg_max || |