All of lore.kernel.org
 help / color / mirror / Atom feed
* + proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch added to -mm tree
@ 2018-12-14  4:34 akpm
  2018-12-14 16:21 ` Luis Chamberlain
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2018-12-14  4:34 UTC (permalink / raw)
  To: adobriyan, akpm, colona, ebiederm, keescook, mcgrof, mm-commits,
	stable, viro


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

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Ivan Delalande <colona@arista.com>
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.

Link: http://lkml.kernel.org/r/20181213232052.GA1513@visor
Fixes: ace0c791e6c3 ("proc/sysctl: Don't grab i_lock under sysctl_lock.")
Signed-off-by: Ivan Delalande <colona@arista.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---


--- a/fs/proc/proc_sysctl.c~proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering
+++ a/fs/proc/proc_sysctl.c
@@ -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 colona@arista.com are

proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: + proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch added to -mm tree
  2018-12-14  4:34 + proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch added to -mm tree akpm
@ 2018-12-14 16:21 ` Luis Chamberlain
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2018-12-14 16:21 UTC (permalink / raw)
  To: akpm; +Cc: adobriyan, colona, ebiederm, keescook, mm-commits, stable, viro

Just a heads up - Al applied a v2 with a modification he made, so
probably best to drop this patch from -mm.

  Luis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-14 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14  4:34 + proc-sysctl-dont-return-enomem-on-lookup-when-a-table-is-unregistering.patch added to -mm tree akpm
2018-12-14 16:21 ` Luis Chamberlain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.