diff options
Diffstat (limited to 'ipc/mqueue.c')
| -rw-r--r-- | ipc/mqueue.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 04985a7256c..3660c334ee6 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
| @@ -134,7 +134,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb, | |||
| 134 | init_waitqueue_head(&info->wait_q); | 134 | init_waitqueue_head(&info->wait_q); |
| 135 | INIT_LIST_HEAD(&info->e_wait_q[0].list); | 135 | INIT_LIST_HEAD(&info->e_wait_q[0].list); |
| 136 | INIT_LIST_HEAD(&info->e_wait_q[1].list); | 136 | INIT_LIST_HEAD(&info->e_wait_q[1].list); |
| 137 | info->messages = NULL; | ||
| 138 | info->notify_owner = NULL; | 137 | info->notify_owner = NULL; |
| 139 | info->qsize = 0; | 138 | info->qsize = 0; |
| 140 | info->user = NULL; /* set when all is ok */ | 139 | info->user = NULL; /* set when all is ok */ |
| @@ -146,6 +145,10 @@ static struct inode *mqueue_get_inode(struct super_block *sb, | |||
| 146 | info->attr.mq_msgsize = attr->mq_msgsize; | 145 | info->attr.mq_msgsize = attr->mq_msgsize; |
| 147 | } | 146 | } |
| 148 | mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *); | 147 | mq_msg_tblsz = info->attr.mq_maxmsg * sizeof(struct msg_msg *); |
| 148 | info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL); | ||
| 149 | if (!info->messages) | ||
| 150 | goto out_inode; | ||
| 151 | |||
| 149 | mq_bytes = (mq_msg_tblsz + | 152 | mq_bytes = (mq_msg_tblsz + |
| 150 | (info->attr.mq_maxmsg * info->attr.mq_msgsize)); | 153 | (info->attr.mq_maxmsg * info->attr.mq_msgsize)); |
| 151 | 154 | ||
| @@ -154,18 +157,12 @@ static struct inode *mqueue_get_inode(struct super_block *sb, | |||
| 154 | u->mq_bytes + mq_bytes > | 157 | u->mq_bytes + mq_bytes > |
| 155 | p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur) { | 158 | p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur) { |
| 156 | spin_unlock(&mq_lock); | 159 | spin_unlock(&mq_lock); |
| 160 | kfree(info->messages); | ||
| 157 | goto out_inode; | 161 | goto out_inode; |
| 158 | } | 162 | } |
| 159 | u->mq_bytes += mq_bytes; | 163 | u->mq_bytes += mq_bytes; |
| 160 | spin_unlock(&mq_lock); | 164 | spin_unlock(&mq_lock); |
| 161 | 165 | ||
| 162 | info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL); | ||
| 163 | if (!info->messages) { | ||
| 164 | spin_lock(&mq_lock); | ||
| 165 | u->mq_bytes -= mq_bytes; | ||
| 166 | spin_unlock(&mq_lock); | ||
| 167 | goto out_inode; | ||
| 168 | } | ||
| 169 | /* all is ok */ | 166 | /* all is ok */ |
| 170 | info->user = get_uid(u); | 167 | info->user = get_uid(u); |
| 171 | } else if (S_ISDIR(mode)) { | 168 | } else if (S_ISDIR(mode)) { |
