aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index d43c30f72f1d..ed049ea568f4 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -113,6 +113,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
113{ 113{
114 struct user_struct *u = current_user(); 114 struct user_struct *u = current_user();
115 struct inode *inode; 115 struct inode *inode;
116 int ret = -ENOMEM;
116 117
117 inode = new_inode(sb); 118 inode = new_inode(sb);
118 if (!inode) 119 if (!inode)
@@ -160,6 +161,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
160 u->mq_bytes + mq_bytes > task_rlimit(p, RLIMIT_MSGQUEUE)) { 161 u->mq_bytes + mq_bytes > task_rlimit(p, RLIMIT_MSGQUEUE)) {
161 spin_unlock(&mq_lock); 162 spin_unlock(&mq_lock);
162 /* mqueue_evict_inode() releases info->messages */ 163 /* mqueue_evict_inode() releases info->messages */
164 ret = -EMFILE;
163 goto out_inode; 165 goto out_inode;
164 } 166 }
165 u->mq_bytes += mq_bytes; 167 u->mq_bytes += mq_bytes;
@@ -179,7 +181,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
179out_inode: 181out_inode:
180 iput(inode); 182 iput(inode);
181err: 183err:
182 return NULL; 184 return ERR_PTR(ret);
183} 185}
184 186
185static int mqueue_fill_super(struct super_block *sb, void *data, int silent) 187static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
@@ -195,8 +197,8 @@ static int mqueue_fill_super(struct super_block *sb, void *data, int silent)
195 197
196 inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO, 198 inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO,
197 NULL); 199 NULL);
198 if (!inode) { 200 if (IS_ERR(inode)) {
199 error = -ENOMEM; 201 error = PTR_ERR(inode);
200 goto out; 202 goto out;
201 } 203 }
202 204
@@ -316,8 +318,8 @@ static int mqueue_create(struct inode *dir, struct dentry *dentry,
316 spin_unlock(&mq_lock); 318 spin_unlock(&mq_lock);
317 319
318 inode = mqueue_get_inode(dir->i_sb, ipc_ns, mode, attr); 320 inode = mqueue_get_inode(dir->i_sb, ipc_ns, mode, attr);
319 if (!inode) { 321 if (IS_ERR(inode)) {
320 error = -ENOMEM; 322 error = PTR_ERR(inode);
321 spin_lock(&mq_lock); 323 spin_lock(&mq_lock);
322 ipc_ns->mq_queues_count--; 324 ipc_ns->mq_queues_count--;
323 goto out_unlock; 325 goto out_unlock;