Commit 213dd266d48af90c1eec8688c1ff31aa34d21de2

Authored by Eric W. Biederman
Committed by Linus Torvalds
1 parent e3a68e30d2

namespace: ensure clone_flags are always stored in an unsigned long

While working on unshare support for the network namespace I noticed we
were putting clone flags in an int.  Which is weird because the syscall
uses unsigned long and we at least need an unsigned to properly hold all of
the unshare flags.

So to make the code consistent, this patch updates the code to use
unsigned long instead of int for the clone flags in those places
where we get it wrong today.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 8 changed files with 11 additions and 10 deletions Side-by-side Diff

... ... @@ -1509,7 +1509,7 @@
1509 1509 return new_ns;
1510 1510 }
1511 1511  
1512   -struct mnt_namespace *copy_mnt_ns(int flags, struct mnt_namespace *ns,
  1512 +struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
1513 1513 struct fs_struct *new_fs)
1514 1514 {
1515 1515 struct mnt_namespace *new_ns;
include/linux/mnt_namespace.h
... ... @@ -14,7 +14,7 @@
14 14 int event;
15 15 };
16 16  
17   -extern struct mnt_namespace *copy_mnt_ns(int, struct mnt_namespace *,
  17 +extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
18 18 struct fs_struct *);
19 19 extern void __put_mnt_ns(struct mnt_namespace *ns);
20 20  
include/linux/nsproxy.h
... ... @@ -32,7 +32,7 @@
32 32 };
33 33 extern struct nsproxy init_nsproxy;
34 34  
35   -int copy_namespaces(int flags, struct task_struct *tsk);
  35 +int copy_namespaces(unsigned long flags, struct task_struct *tsk);
36 36 void get_task_namespaces(struct task_struct *tsk);
37 37 void free_nsproxy(struct nsproxy *ns);
38 38 int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
include/linux/pid_namespace.h
... ... @@ -29,7 +29,7 @@
29 29 kref_get(&ns->kref);
30 30 }
31 31  
32   -extern struct pid_namespace *copy_pid_ns(int flags, struct pid_namespace *ns);
  32 +extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
33 33 extern void free_pid_ns(struct kref *kref);
34 34  
35 35 static inline void put_pid_ns(struct pid_namespace *ns)
include/linux/utsname.h
... ... @@ -48,7 +48,8 @@
48 48 kref_get(&ns->kref);
49 49 }
50 50  
51   -extern struct uts_namespace *copy_utsname(int flags, struct uts_namespace *ns);
  51 +extern struct uts_namespace *copy_utsname(unsigned long flags,
  52 + struct uts_namespace *ns);
52 53 extern void free_uts_ns(struct kref *kref);
53 54  
54 55 static inline void put_uts_ns(struct uts_namespace *ns)
... ... @@ -58,8 +58,8 @@
58 58 * Return the newly created nsproxy. Do not attach this to the task,
59 59 * leave it to the caller to do proper locking and attach it to task.
60 60 */
61   -static struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk,
62   - struct fs_struct *new_fs)
  61 +static struct nsproxy *create_new_namespaces(unsigned long flags,
  62 + struct task_struct *tsk, struct fs_struct *new_fs)
63 63 {
64 64 struct nsproxy *new_nsp;
65 65 int err;
... ... @@ -121,7 +121,7 @@
121 121 * called from clone. This now handles copy for nsproxy and all
122 122 * namespaces therein.
123 123 */
124   -int copy_namespaces(int flags, struct task_struct *tsk)
  124 +int copy_namespaces(unsigned long flags, struct task_struct *tsk)
125 125 {
126 126 struct nsproxy *old_ns = tsk->nsproxy;
127 127 struct nsproxy *new_ns;
... ... @@ -365,7 +365,7 @@
365 365 }
366 366 EXPORT_SYMBOL_GPL(find_get_pid);
367 367  
368   -struct pid_namespace *copy_pid_ns(int flags, struct pid_namespace *old_ns)
  368 +struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old_ns)
369 369 {
370 370 BUG_ON(!old_ns);
371 371 get_pid_ns(old_ns);
... ... @@ -39,7 +39,7 @@
39 39 * utsname of this process won't be seen by parent, and vice
40 40 * versa.
41 41 */
42   -struct uts_namespace *copy_utsname(int flags, struct uts_namespace *old_ns)
  42 +struct uts_namespace *copy_utsname(unsigned long flags, struct uts_namespace *old_ns)
43 43 {
44 44 struct uts_namespace *new_ns;
45 45