Re: [PATCH v2] proc/sysctl: don't return ENOMEM on lookup when a table is unregistering

From: Al Viro
Date: Thu Dec 13 2018 - 20:45:59 EST


On Thu, Dec 13, 2018 at 03:20:52PM -0800, Ivan Delalande wrote:

> @@ -474,7 +474,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
> if (unlikely(head->unregistering)) {
> spin_unlock(&sysctl_lock);
> iput(inode);
> - inode = NULL;
> + inode = ERR_PTR(-ENOENT);
> goto out;
> }

Applied, with one modification: if you look at the target of that goto,
you'll see
out:
return inode;
so this place should be simply
spin_unlock(&sysctl_lock);
iput(inode);
return ERR_PTR(-ENOENT);
}

That way the label becomes unused and goes away.