All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Boris Sukholitko <boris.sukholitko@broadcom.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, keescook@chromium.org, yzaikin@google.com
Subject: Re: [PATCH] __register_sysctl_table: do not drop subdir
Date: Wed, 27 May 2020 12:58:05 +0000	[thread overview]
Message-ID: <20200527125805.GI11244@42.do-not-panic.com> (raw)
In-Reply-To: <20200527104848.GA7914@nixbox>

Eric since you authored the code which this code claism to fix, your
review would be appreciated.

On Wed, May 27, 2020 at 01:48:48PM +0300, Boris Sukholitko wrote:
> Successful get_subdir returns dir with its header.nreg properly
> adjusted. No need to drop the dir in that case.

This commit log is not that clear to me, can you explain what happens
without this patch, and how critical it is to fix it. How did you
notice this issue? If you don't apply this patch what issue do you
see?

Do we test for it? Can we?

  Luis

> 
> Signed-off-by: Boris Sukholitko <boris.sukholitko@broadcom.com>
> Fixes: 7ec66d06362d (sysctl: Stop requiring explicit management of sysctl directories)
> ---
>  fs/proc/proc_sysctl.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> index b6f5d459b087..6f237f0eb531 100644
> --- a/fs/proc/proc_sysctl.c
> +++ b/fs/proc/proc_sysctl.c
> @@ -1286,8 +1286,8 @@ struct ctl_table_header *__register_sysctl_table(
>  {
>  	struct ctl_table_root *root = set->dir.header.root;
>  	struct ctl_table_header *header;
> +	struct ctl_dir *dir, *start_dir;
>  	const char *name, *nextname;
> -	struct ctl_dir *dir;
>  	struct ctl_table *entry;
>  	struct ctl_node *node;
>  	int nr_entries = 0;
> @@ -1307,6 +1307,7 @@ struct ctl_table_header *__register_sysctl_table(
>  
>  	spin_lock(&sysctl_lock);
>  	dir = &set->dir;
> +	start_dir = dir;
>  	/* Reference moved down the diretory tree get_subdir */
>  	dir->header.nreg++;
>  	spin_unlock(&sysctl_lock);
> @@ -1333,7 +1334,8 @@ struct ctl_table_header *__register_sysctl_table(
>  	if (insert_header(dir, header))
>  		goto fail_put_dir_locked;
>  
> -	drop_sysctl_table(&dir->header);
> +	if (start_dir == dir)
> +		drop_sysctl_table(&dir->header);
>  	spin_unlock(&sysctl_lock);
>  
>  	return header;
> -- 
> 2.23.1
> 

  reply	other threads:[~2020-05-27 12:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 10:48 [PATCH] __register_sysctl_table: do not drop subdir Boris Sukholitko
2020-05-27 12:58 ` Luis Chamberlain [this message]
2020-05-28  8:08   ` Boris Sukholitko
2020-05-28 14:04     ` Eric W. Biederman
2020-05-28 14:20       ` Luis Chamberlain
2020-05-31 11:44         ` Boris Sukholitko
2020-06-01 13:17           ` Luis Chamberlain
2020-05-31 11:39       ` Boris Sukholitko
2020-06-03  1:07 ` [__register_sysctl_table] 4092a9304d: WARNING:at_fs/proc/proc_sysctl.c:#retire_sysctl_set kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200527125805.GI11244@42.do-not-panic.com \
    --to=mcgrof@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=boris.sukholitko@broadcom.com \
    --cc=ebiederm@xmission.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.