mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Octavian Purdila <opurdila@ixiacom.com>,
	WANG Cong <amwang@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Dave Young <hidave.darkstar@gmail.com>,
	Don Zickus <dzickus@redhat.com>, Vlad Dogaru <ddvlad@rosedu.org>
Subject: Re: [PATCH] sysctl: ctl_table->parent is only used for sysctl checks
Date: Wed, 12 Jan 2011 07:55:04 -0800	[thread overview]
Message-ID: <m1d3o2ce1z.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <AANLkTimRM6=g+4adii9die0F+AG6D2rrb0ntczqCUKPD@mail.gmail.com> (Lucian Adrian Grijincu's message of "Wed, 12 Jan 2011 12:17:07 +0200")

Lucian Adrian Grijincu <lucian.grijincu@gmail.com> writes:

See selinux_sysctl_get_sid.

> Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
> ---
>  include/linux/sysctl.h |    2 ++
>  kernel/sysctl.c        |    7 +++++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index 7bb5cb6..026681f 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -1018,7 +1018,9 @@ struct ctl_table
>  	int maxlen;
>  	mode_t mode;
>  	struct ctl_table *child;
> +#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
>  	struct ctl_table *parent;	/* Automatically set */
> +#endif
>  	proc_handler *proc_handler;	/* Callback for text formatting */
>  	void *extra1;
>  	void *extra2;
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index ae5cbb1..c5bade1 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1706,6 +1706,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
>  	return test_perm(mode, op);
>  }
>  
> +#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
>  static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
>  {
>  	for (; table->procname; table++) {
> @@ -1714,11 +1715,13 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
>  			sysctl_set_parent(table, table->child);
>  	}
>  }
> +#endif
> +
>  
>  static __init int sysctl_init(void)
>  {
> -	sysctl_set_parent(NULL, root_table);
>  #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
> +	sysctl_set_parent(NULL, root_table);
>  	sysctl_check_table(current->nsproxy, root_table);
>  #endif
>  	return 0;
> @@ -1875,9 +1878,9 @@ struct ctl_table_header *__register_sysctl_paths(
>  	header->used = 0;
>  	header->unregistering = NULL;
>  	header->root = root;
> -	sysctl_set_parent(NULL, header->ctl_table);
>  	header->count = 1;
>  #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
> +	sysctl_set_parent(NULL, header->ctl_table);
>  	if (sysctl_check_table(namespaces, header->ctl_table)) {
>  		kfree(header);
>  		return NULL;

      reply	other threads:[~2011-01-12 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 10:17 Lucian Adrian Grijincu
2011-01-12 15:55 ` Eric W. Biederman [this message]

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=m1d3o2ce1z.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ddvlad@rosedu.org \
    --cc=dzickus@redhat.com \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucian.grijincu@gmail.com \
    --cc=mingo@elte.hu \
    --cc=opurdila@ixiacom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®