Skip to contentSkip to conversation

proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch removed from -mm tree

merged [email protected] 1 participant 1 message Dec 17, 2018 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: proc/sysctl: don't return ENOMEM on lookup when a table is unregistering
has been removed from the -mm tree. Its filename was
proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Ivan Delalande <[email protected]>
Subject: proc/sysctl: don't return ENOMEM on lookup when a table is unregistering

proc_sys_lookup can fail with ENOMEM instead of ENOENT when the corresponding sysctl table is being unregistered. In our case we see this upon opening /proc/sys/net/*/conf files while network interfaces are being deleted, which confuses our configuration daemon.

The problem was successfully reproduced and this fix tested on v4.9.122 and v4.20-rc6.

Fixes ace0c791e6c3 ("proc/sysctl: Don't grab i_lock under sysctl_lock.")
Cc Luis Chamberlain <[email protected]>
Cc Kees Cook <[email protected]>
Cc Al Viro <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Alexey Dobriyan <[email protected]>

---

 fs/proc/proc_sysctl.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
fs/proc/proc_sysctl.c renamed from fs/proc/proc_sysctl.c~proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering +6 -5
@@ -464,7 +464,7 @@ static struct inode *proc_sys_make_inode
 
 	inode = new_inode(sb);
 	if (!inode)
-		goto out;
+		return ERR_PTR(-ENOMEM);
 
 	inode->i_ino = get_next_ino();
 
@@ -474,7 +474,7 @@ static struct inode *proc_sys_make_inode
 	if (unlikely(head->unregistering)) {
 		spin_unlock(&sysctl_lock);
 		iput(inode);
-		inode = NULL;
+		inode = ERR_PTR(-ENOENT);
 		goto out;
 	}
 	ei->sysctl = head;
@@ -549,10 +549,11 @@ static struct dentry *proc_sys_lookup(st
 			goto out;
 	}
 
-	err = ERR_PTR(-ENOMEM);
 	inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
-	if (!inode)
+	if (IS_ERR(inode)) {
+		err = ERR_CAST(inode);
 		goto out;
+	}
 
 	d_set_d_op(dentry, &proc_sys_dentry_operations);
 	err = d_splice_alias(inode, dentry);
@@ -685,7 +686,7 @@ static bool proc_sys_fill_cache(struct f
 		if (d_in_lookup(child)) {
 			struct dentry *res;
 			inode = proc_sys_make_inode(dir->d_sb, head, table);
-			if (!inode) {
+			if (IS_ERR(inode)) {
 				d_lookup_done(child);
 				dput(child);
 				return false;

_

Patches currently in -mm which might be from [email protected] are