Skip to contentSkip to conversation

namespaces: utsname: fix wrong comment about clone_uts_ns()

PATCH In review Yuanhan Liu 2 participants 5 messages Jan 31, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 namespaces: utsname: fix wrong comment about clone_uts_ns()

Fix the wrong comment about the return value of clone_uts_ns()

---
 kernel/utsname.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/utsname.c +1 -1
index 08b197e..a47fc5d 100644
@@ -30,7 +30,7 @@ static struct uts_namespace *create_uts_ns(void)
 /*
  * Clone a new ns copying an original utsname, setting refcount to 1
  * @old_ns: namespace to clone
- * Return NULL on error (failure to kmalloc), new ns otherwise
+ * Return ERR_PTR(-ENOMEM) on error (failure to kmalloc), new ns otherwise
  */
 static struct uts_namespace *clone_uts_ns(struct user_namespace *user_ns,
 					  struct uts_namespace *old_ns)
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 2/3 sysctl: put get/get_uts() into CONFIG_PROC_SYSCTL code block

put get/get_uts() into CONFIG_PROC_SYSCTL code block as they are used only when CONFIG_PROC_SYSCTL is enabled.

---
 kernel/utsname_sysctl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
kernel/utsname_sysctl.c +2 -1
index 63da38c..4f69f9a 100644
@@ -15,6 +15,8 @@
 #include <linux/sysctl.h>
 #include <linux/wait.h>
 
+#ifdef CONFIG_PROC_SYSCTL
+
 static void *get_uts(ctl_table *table, int write)
 {
 	char *which = table->data;
@@ -38,7 +40,6 @@ static void put_uts(ctl_table *table, int write, void *which)
 		up_write(&uts_sem);
 }
 
-#ifdef CONFIG_PROC_SYSCTL
 /*
  *	Special case of dostring for the UTS structure. This has locks
  *	to observe. Should this be in kernel/sys.c ????
Signature · 1 line
1.7.7.6
#2 lore raw

PATCH 3/3 nsproxy: remove duplicate task_cred_xxx for user_ns

In reply to Yuanhan Liu

We can use user_ns, which is also assigned from task_cred_xxx(tsk, user_ns), at the beginning of copy_namespaces().

---
 kernel/nsproxy.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/nsproxy.c +1 -2
index 78e2ecb..b781e66 100644
@@ -153,8 +153,7 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
 		goto out;
 	}
 
-	new_ns = create_new_namespaces(flags, tsk,
-				       task_cred_xxx(tsk, user_ns), tsk->fs);
+	new_ns = create_new_namespaces(flags, tsk, user_ns, tsk->fs);
 	if (IS_ERR(new_ns)) {
 		err = PTR_ERR(new_ns);
 		goto out;
Signature · 1 line
1.7.7.6
Acked-by Serge Hallyn on v1 3/3
#3 lore raw

Re: [PATCH 3/3] nsproxy: remove duplicate task_cred_xxx for user_ns

Quoted 4 lines · Yuanhan Liu

We can use user_ns, which is also assigned from task_cred_xxx(tsk, user_ns), at the beginning of copy_namespaces().

Cc Serge Hallyn <[email protected]>
Quoted 27 lines
---
 kernel/nsproxy.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/nsproxy.c +1 -2
index 78e2ecb..b781e66 100644
@@ -153,8 +153,7 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
 		goto out;
 	}
 
-	new_ns = create_new_namespaces(flags, tsk,
-				       task_cred_xxx(tsk, user_ns), tsk->fs);
+	new_ns = create_new_namespaces(flags, tsk, user_ns, tsk->fs);
 	if (IS_ERR(new_ns)) {
 		err = PTR_ERR(new_ns);
 		goto out;
Signature · 7 lines
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Acked-by Serge Hallyn on v1 1/3
#4 lore raw
In reply to Yuanhan Liu
Quoted 3 lines · Yuanhan Liu

Fix the wrong comment about the return value of clone_uts_ns()

Cc Serge Hallyn <[email protected]>
Quoted 26 lines
---
 kernel/utsname.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/utsname.c +1 -1
index 08b197e..a47fc5d 100644
@@ -30,7 +30,7 @@ static struct uts_namespace *create_uts_ns(void)
 /*
  * Clone a new ns copying an original utsname, setting refcount to 1
  * @old_ns: namespace to clone
- * Return NULL on error (failure to kmalloc), new ns otherwise
+ * Return ERR_PTR(-ENOMEM) on error (failure to kmalloc), new ns otherwise
  */
 static struct uts_namespace *clone_uts_ns(struct user_namespace *user_ns,
 					  struct uts_namespace *old_ns)
Signature · 7 lines
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/