public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sysctl: ctl_table->parent is only used for sysctl checks
@ 2011-01-12 10:17 Lucian Adrian Grijincu
  2011-01-12 15:55 ` Eric W. Biederman
  0 siblings, 1 reply; 2+ messages in thread
From: Lucian Adrian Grijincu @ 2011-01-12 10:17 UTC (permalink / raw)
  To: linux-kernel, Eric W. Biederman
  Cc: David S. Miller, Octavian Purdila, WANG Cong, Andrew Morton,
	Ingo Molnar, Dave Young, Don Zickus, Vlad Dogaru

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

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(-)

[-- Attachment #2: 0002-sysctl-ctl_table-parent-is-only-used-for-sysctl-chec.patch --]
[-- Type: text/x-patch, Size: 1686 bytes --]

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;

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

* Re: [PATCH] sysctl: ctl_table->parent is only used for sysctl checks
  2011-01-12 10:17 [PATCH] sysctl: ctl_table->parent is only used for sysctl checks Lucian Adrian Grijincu
@ 2011-01-12 15:55 ` Eric W. Biederman
  0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2011-01-12 15:55 UTC (permalink / raw)
  To: Lucian Adrian Grijincu
  Cc: linux-kernel, David S. Miller, Octavian Purdila, WANG Cong,
	Andrew Morton, Ingo Molnar, Dave Young, Don Zickus, Vlad Dogaru

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;

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

end of thread, other threads:[~2011-01-12 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12 10:17 [PATCH] sysctl: ctl_table->parent is only used for sysctl checks Lucian Adrian Grijincu
2011-01-12 15:55 ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox