Skip to contentSkip to conversation

utsname namespace : fix unshare when CONFIG_UTS_NS is not set

PATCH In review Cedric Le Goater 2 participants 2 messages Sep 14, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utsname namespace : fix unshare when CONFIG_UTS_NS is not set

If the kernel is not configured with the CONFIG_UTS_NS, unshare of ipc namespace will fail and return -EINVAL.

The patch changes the dummy unshare_utsname() to check the clone flags before returning.

Cc Andrew Morton <[email protected]>
Cc Serge E. Hallyn <[email protected]>
Cc Linux Containers <[email protected]>
---
 include/linux/utsname.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/utsname.h +5 -1
Index: 2.6.18-rc6-mm2/include/linux/utsname.h
===================================================================
@@ -60,8 +60,12 @@ static inline void put_uts_ns(struct uts
 static inline int unshare_utsname(unsigned long unshare_flags,
 			struct uts_namespace **new_uts)
 {
-	return -EINVAL;
+	if (unshare_flags & CLONE_NEWUTS)
+		return -EINVAL;
+
+	return 0;
 }
+
 static inline int copy_utsname(int flags, struct task_struct *tsk)
 {
 	return 0;
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Cedric Le Goater

If the kernel is not configured with the CONFIG_UTS_NS, unshare of ipc namespace will fail and return -EINVAL.

The patch changes the dummy unshare_utsname() to check the clone flags before returning.

thanks,
-serge

Quoted 26 lines
Cc Andrew Morton <[email protected]>
Cc Serge E. Hallyn <[email protected]>
Cc Linux Containers <[email protected]>
---
 include/linux/utsname.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: 2.6.18-rc6-mm2/include/linux/utsname.h
===================================================================

include/linux/utsname.h +5 -1
@@ -60,8 +60,12 @@ static inline void put_uts_ns(struct uts
 static inline int unshare_utsname(unsigned long unshare_flags,
 			struct uts_namespace **new_uts)
 {
-	return -EINVAL;
+	if (unshare_flags & CLONE_NEWUTS)
+		return -EINVAL;
+
+	return 0;
 }
+
 static inline int copy_utsname(int flags, struct task_struct *tsk)
 {
 	return 0;