Commit 3c730b10 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
 "A couple of fixes - no common topic ;-)"

[ The aio spectre patch also came in from Jens, so now we have that
  doubly fixed .. ]

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  proc/sysctl: don't return ENOMEM on lookup when a table is unregistering
  aio: fix spectre gadget in lookup_ioctx
parents 9105b8aa ea5751cc
...@@ -464,7 +464,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, ...@@ -464,7 +464,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
inode = new_inode(sb); inode = new_inode(sb);
if (!inode) if (!inode)
goto out; return ERR_PTR(-ENOMEM);
inode->i_ino = get_next_ino(); inode->i_ino = get_next_ino();
...@@ -474,8 +474,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, ...@@ -474,8 +474,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
if (unlikely(head->unregistering)) { if (unlikely(head->unregistering)) {
spin_unlock(&sysctl_lock); spin_unlock(&sysctl_lock);
iput(inode); iput(inode);
inode = NULL; return ERR_PTR(-ENOENT);
goto out;
} }
ei->sysctl = head; ei->sysctl = head;
ei->sysctl_entry = table; ei->sysctl_entry = table;
...@@ -500,7 +499,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, ...@@ -500,7 +499,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
if (root->set_ownership) if (root->set_ownership)
root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); root->set_ownership(head, table, &inode->i_uid, &inode->i_gid);
out:
return inode; return inode;
} }
...@@ -549,10 +547,11 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, ...@@ -549,10 +547,11 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
goto out; goto out;
} }
err = ERR_PTR(-ENOMEM);
inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
if (!inode) if (IS_ERR(inode)) {
err = ERR_CAST(inode);
goto out; goto out;
}
d_set_d_op(dentry, &proc_sys_dentry_operations); d_set_d_op(dentry, &proc_sys_dentry_operations);
err = d_splice_alias(inode, dentry); err = d_splice_alias(inode, dentry);
...@@ -685,7 +684,7 @@ static bool proc_sys_fill_cache(struct file *file, ...@@ -685,7 +684,7 @@ static bool proc_sys_fill_cache(struct file *file,
if (d_in_lookup(child)) { if (d_in_lookup(child)) {
struct dentry *res; struct dentry *res;
inode = proc_sys_make_inode(dir->d_sb, head, table); inode = proc_sys_make_inode(dir->d_sb, head, table);
if (!inode) { if (IS_ERR(inode)) {
d_lookup_done(child); d_lookup_done(child);
dput(child); dput(child);
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment