aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/proc_sysctl.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 89921a0d2ebb..4d598a399bbf 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -464,7 +464,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
464 464
465 inode = new_inode(sb); 465 inode = new_inode(sb);
466 if (!inode) 466 if (!inode)
467 goto out; 467 return ERR_PTR(-ENOMEM);
468 468
469 inode->i_ino = get_next_ino(); 469 inode->i_ino = get_next_ino();
470 470
@@ -474,8 +474,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
474 if (unlikely(head->unregistering)) { 474 if (unlikely(head->unregistering)) {
475 spin_unlock(&sysctl_lock); 475 spin_unlock(&sysctl_lock);
476 iput(inode); 476 iput(inode);
477 inode = NULL; 477 return ERR_PTR(-ENOENT);
478 goto out;
479 } 478 }
480 ei->sysctl = head; 479 ei->sysctl = head;
481 ei->sysctl_entry = table; 480 ei->sysctl_entry = table;
@@ -500,7 +499,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
500 if (root->set_ownership) 499 if (root->set_ownership)
501 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); 500 root->set_ownership(head, table, &inode->i_uid, &inode->i_gid);
502 501
503out:
504 return inode; 502 return inode;
505} 503}
506 504
@@ -549,10 +547,11 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
549 goto out; 547 goto out;
550 } 548 }
551 549
552 err = ERR_PTR(-ENOMEM);
553 inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); 550 inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
554 if (!inode) 551 if (IS_ERR(inode)) {
552 err = ERR_CAST(inode);
555 goto out; 553 goto out;
554 }
556 555
557 d_set_d_op(dentry, &proc_sys_dentry_operations); 556 d_set_d_op(dentry, &proc_sys_dentry_operations);
558 err = d_splice_alias(inode, dentry); 557 err = d_splice_alias(inode, dentry);
@@ -685,7 +684,7 @@ static bool proc_sys_fill_cache(struct file *file,
685 if (d_in_lookup(child)) { 684 if (d_in_lookup(child)) {
686 struct dentry *res; 685 struct dentry *res;
687 inode = proc_sys_make_inode(dir->d_sb, head, table); 686 inode = proc_sys_make_inode(dir->d_sb, head, table);
688 if (!inode) { 687 if (IS_ERR(inode)) {
689 d_lookup_done(child); 688 d_lookup_done(child);
690 dput(child); 689 dput(child);
691 return false; 690 return false;