aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/mqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r--ipc/mqueue.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 6e10a55a78c5..f8eba5e46c5a 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -24,6 +24,7 @@
24#include <linux/mqueue.h> 24#include <linux/mqueue.h>
25#include <linux/msg.h> 25#include <linux/msg.h>
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <linux/vmalloc.h>
27#include <linux/netlink.h> 28#include <linux/netlink.h>
28#include <linux/syscalls.h> 29#include <linux/syscalls.h>
29#include <linux/audit.h> 30#include <linux/audit.h>
@@ -152,7 +153,10 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
152 info->attr.mq_msgsize = attr->mq_msgsize; 153 info->attr.mq_msgsize = attr->mq_msgsize;
153 } 154 }
154 mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *); 155 mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *);
155 info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL); 156 if (mq_msg_tblsz > KMALLOC_MAX_SIZE)
157 info->messages = vmalloc(mq_msg_tblsz);
158 else
159 info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL);
156 if (!info->messages) 160 if (!info->messages)
157 goto out_inode; 161 goto out_inode;
158 162
@@ -262,7 +266,10 @@ static void mqueue_evict_inode(struct inode *inode)
262 spin_lock(&info->lock); 266 spin_lock(&info->lock);
263 for (i = 0; i < info->attr.mq_curmsgs; i++) 267 for (i = 0; i < info->attr.mq_curmsgs; i++)
264 free_msg(info->messages[i]); 268 free_msg(info->messages[i]);
265 kfree(info->messages); 269 if (info->attr.mq_maxmsg * sizeof(struct msg_msg *) > KMALLOC_MAX_SIZE)
270 vfree(info->messages);
271 else
272 kfree(info->messages);
266 spin_unlock(&info->lock); 273 spin_unlock(&info->lock);
267 274
268 /* Total amount of bytes accounted for the mqueue */ 275 /* Total amount of bytes accounted for the mqueue */