diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2007-07-17 15:28:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 17:05:08 -0400 |
commit | 626ac545c12e5f9bffe93086d1d03d26c99987ea (patch) | |
tree | 3ff83cc510f09bd0561b3b2a8b769beda952ad17 /include/linux | |
parent | 9550b105b8646f916862aee3ab7b25020ca14159 (diff) |
user namespace: fix copy_user_ns return value
When a CONFIG_USER_NS=n and a user tries to unshare some namespace other
than the user namespace, the dummy copy_user_ns returns NULL rather than
the old_ns.
This value then gets assigned to task->nsproxy->user_ns, so that a
subsequent setuid, which uses task->nsproxy->user_ns, causes a NULL
pointer deref.
Fix this by returning old_ns.
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/user_namespace.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index bb320573bb9e..1101b0ce878f 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h | |||
@@ -49,7 +49,7 @@ static inline struct user_namespace *copy_user_ns(int flags, | |||
49 | if (flags & CLONE_NEWUSER) | 49 | if (flags & CLONE_NEWUSER) |
50 | return ERR_PTR(-EINVAL); | 50 | return ERR_PTR(-EINVAL); |
51 | 51 | ||
52 | return NULL; | 52 | return old_ns; |
53 | } | 53 | } |
54 | 54 | ||
55 | static inline void put_user_ns(struct user_namespace *ns) | 55 | static inline void put_user_ns(struct user_namespace *ns) |