Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309765
b: refs/heads/master
c: 2c12ea4
h: refs/heads/master
i:
  309763: 0b585f0
v: v3
  • Loading branch information
Doug Ledford authored and Linus Torvalds committed Jun 1, 2012
1 parent 98cf88f commit dd3ab03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d6629859b36d953a4b1369b749f178736911bf10
refs/heads/master: 2c12ea498f349207c28840c0ed9654321aab7720
11 changes: 8 additions & 3 deletions trunk/ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ static void remove_notification(struct mqueue_inode_info *info)

static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
{
int mq_treesize;
unsigned long total_size;

if (attr->mq_maxmsg <= 0 || attr->mq_msgsize <= 0)
return 0;
if (capable(CAP_SYS_RESOURCE)) {
Expand All @@ -690,9 +693,11 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
/* check for overflow */
if (attr->mq_msgsize > ULONG_MAX/attr->mq_maxmsg)
return 0;
if ((unsigned long)(attr->mq_maxmsg * (attr->mq_msgsize
+ sizeof (struct msg_msg *))) <
(unsigned long)(attr->mq_maxmsg * attr->mq_msgsize))
mq_treesize = attr->mq_maxmsg * sizeof(struct msg_msg) +
min_t(unsigned int, attr->mq_maxmsg, MQ_PRIO_MAX) *
sizeof(struct posix_msg_tree_node);
total_size = attr->mq_maxmsg * attr->mq_msgsize;
if (total_size + mq_treesize < total_size)
return 0;
return 1;
}
Expand Down

0 comments on commit dd3ab03

Please sign in to comment.