diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/binfmt_aout.c | 5 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 5 | ||||
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 6 | ||||
-rw-r--r-- | fs/binfmt_em86.c | 4 | ||||
-rw-r--r-- | fs/binfmt_flat.c | 5 | ||||
-rw-r--r-- | fs/binfmt_misc.c | 4 | ||||
-rw-r--r-- | fs/binfmt_script.c | 4 | ||||
-rw-r--r-- | fs/binfmt_som.c | 5 | ||||
-rw-r--r-- | fs/coredump.c | 4 | ||||
-rw-r--r-- | fs/exec.c | 37 | ||||
-rw-r--r-- | fs/file.c | 6 | ||||
-rw-r--r-- | fs/fs_struct.c | 24 |
12 files changed, 38 insertions, 71 deletions
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 0e7a6f81ae36..6043567b95c2 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <asm/cacheflush.h> | 30 | #include <asm/cacheflush.h> |
31 | #include <asm/a.out-core.h> | 31 | #include <asm/a.out-core.h> |
32 | 32 | ||
33 | static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); | 33 | static int load_aout_binary(struct linux_binprm *); |
34 | static int load_aout_library(struct file*); | 34 | static int load_aout_library(struct file*); |
35 | 35 | ||
36 | #ifdef CONFIG_COREDUMP | 36 | #ifdef CONFIG_COREDUMP |
@@ -201,8 +201,9 @@ static unsigned long __user *create_aout_tables(char __user *p, struct linux_bin | |||
201 | * libraries. There is no binary dependent code anywhere else. | 201 | * libraries. There is no binary dependent code anywhere else. |
202 | */ | 202 | */ |
203 | 203 | ||
204 | static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | 204 | static int load_aout_binary(struct linux_binprm * bprm) |
205 | { | 205 | { |
206 | struct pt_regs *regs = current_pt_regs(); | ||
206 | struct exec ex; | 207 | struct exec ex; |
207 | unsigned long error; | 208 | unsigned long error; |
208 | unsigned long fd_offset; | 209 | unsigned long fd_offset; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index fbd9f60bd763..6d7d1647a68c 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #define user_siginfo_t siginfo_t | 44 | #define user_siginfo_t siginfo_t |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs); | 47 | static int load_elf_binary(struct linux_binprm *bprm); |
48 | static int load_elf_library(struct file *); | 48 | static int load_elf_library(struct file *); |
49 | static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, | 49 | static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, |
50 | int, int, unsigned long); | 50 | int, int, unsigned long); |
@@ -558,7 +558,7 @@ static unsigned long randomize_stack_top(unsigned long stack_top) | |||
558 | #endif | 558 | #endif |
559 | } | 559 | } |
560 | 560 | ||
561 | static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | 561 | static int load_elf_binary(struct linux_binprm *bprm) |
562 | { | 562 | { |
563 | struct file *interpreter = NULL; /* to shut gcc up */ | 563 | struct file *interpreter = NULL; /* to shut gcc up */ |
564 | unsigned long load_addr = 0, load_bias = 0; | 564 | unsigned long load_addr = 0, load_bias = 0; |
@@ -575,6 +575,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
575 | unsigned long reloc_func_desc __maybe_unused = 0; | 575 | unsigned long reloc_func_desc __maybe_unused = 0; |
576 | int executable_stack = EXSTACK_DEFAULT; | 576 | int executable_stack = EXSTACK_DEFAULT; |
577 | unsigned long def_flags = 0; | 577 | unsigned long def_flags = 0; |
578 | struct pt_regs *regs = current_pt_regs(); | ||
578 | struct { | 579 | struct { |
579 | struct elfhdr elf_ex; | 580 | struct elfhdr elf_ex; |
580 | struct elfhdr interp_elf_ex; | 581 | struct elfhdr interp_elf_ex; |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index a46049154107..dc84732e554f 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -56,7 +56,7 @@ typedef char *elf_caddr_t; | |||
56 | 56 | ||
57 | MODULE_LICENSE("GPL"); | 57 | MODULE_LICENSE("GPL"); |
58 | 58 | ||
59 | static int load_elf_fdpic_binary(struct linux_binprm *, struct pt_regs *); | 59 | static int load_elf_fdpic_binary(struct linux_binprm *); |
60 | static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *, struct file *); | 60 | static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *, struct file *); |
61 | static int elf_fdpic_map_file(struct elf_fdpic_params *, struct file *, | 61 | static int elf_fdpic_map_file(struct elf_fdpic_params *, struct file *, |
62 | struct mm_struct *, const char *); | 62 | struct mm_struct *, const char *); |
@@ -164,10 +164,10 @@ static int elf_fdpic_fetch_phdrs(struct elf_fdpic_params *params, | |||
164 | /* | 164 | /* |
165 | * load an fdpic binary into various bits of memory | 165 | * load an fdpic binary into various bits of memory |
166 | */ | 166 | */ |
167 | static int load_elf_fdpic_binary(struct linux_binprm *bprm, | 167 | static int load_elf_fdpic_binary(struct linux_binprm *bprm) |
168 | struct pt_regs *regs) | ||
169 | { | 168 | { |
170 | struct elf_fdpic_params exec_params, interp_params; | 169 | struct elf_fdpic_params exec_params, interp_params; |
170 | struct pt_regs *regs = current_pt_regs(); | ||
171 | struct elf_phdr *phdr; | 171 | struct elf_phdr *phdr; |
172 | unsigned long stack_size, entryaddr; | 172 | unsigned long stack_size, entryaddr; |
173 | #ifdef ELF_FDPIC_PLAT_INIT | 173 | #ifdef ELF_FDPIC_PLAT_INIT |
diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c index 2790c7e1912e..4e6cce57d113 100644 --- a/fs/binfmt_em86.c +++ b/fs/binfmt_em86.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #define EM86_INTERP "/usr/bin/em86" | 22 | #define EM86_INTERP "/usr/bin/em86" |
23 | #define EM86_I_NAME "em86" | 23 | #define EM86_I_NAME "em86" |
24 | 24 | ||
25 | static int load_em86(struct linux_binprm *bprm,struct pt_regs *regs) | 25 | static int load_em86(struct linux_binprm *bprm) |
26 | { | 26 | { |
27 | char *interp, *i_name, *i_arg; | 27 | char *interp, *i_name, *i_arg; |
28 | struct file * file; | 28 | struct file * file; |
@@ -90,7 +90,7 @@ static int load_em86(struct linux_binprm *bprm,struct pt_regs *regs) | |||
90 | if (retval < 0) | 90 | if (retval < 0) |
91 | return retval; | 91 | return retval; |
92 | 92 | ||
93 | return search_binary_handler(bprm, regs); | 93 | return search_binary_handler(bprm); |
94 | } | 94 | } |
95 | 95 | ||
96 | static struct linux_binfmt em86_format = { | 96 | static struct linux_binfmt em86_format = { |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index e280352b28f9..b56371981d16 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -88,7 +88,7 @@ struct lib_info { | |||
88 | static int load_flat_shared_library(int id, struct lib_info *p); | 88 | static int load_flat_shared_library(int id, struct lib_info *p); |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs); | 91 | static int load_flat_binary(struct linux_binprm *); |
92 | static int flat_core_dump(struct coredump_params *cprm); | 92 | static int flat_core_dump(struct coredump_params *cprm); |
93 | 93 | ||
94 | static struct linux_binfmt flat_format = { | 94 | static struct linux_binfmt flat_format = { |
@@ -858,9 +858,10 @@ out: | |||
858 | * libraries. There is no binary dependent code anywhere else. | 858 | * libraries. There is no binary dependent code anywhere else. |
859 | */ | 859 | */ |
860 | 860 | ||
861 | static int load_flat_binary(struct linux_binprm * bprm, struct pt_regs * regs) | 861 | static int load_flat_binary(struct linux_binprm * bprm) |
862 | { | 862 | { |
863 | struct lib_info libinfo; | 863 | struct lib_info libinfo; |
864 | struct pt_regs *regs = current_pt_regs(); | ||
864 | unsigned long p = bprm->p; | 865 | unsigned long p = bprm->p; |
865 | unsigned long stack_len; | 866 | unsigned long stack_len; |
866 | unsigned long start_addr; | 867 | unsigned long start_addr; |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 790b3cddca67..b0b70fbea06c 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -104,7 +104,7 @@ static Node *check_file(struct linux_binprm *bprm) | |||
104 | /* | 104 | /* |
105 | * the loader itself | 105 | * the loader itself |
106 | */ | 106 | */ |
107 | static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) | 107 | static int load_misc_binary(struct linux_binprm *bprm) |
108 | { | 108 | { |
109 | Node *fmt; | 109 | Node *fmt; |
110 | struct file * interp_file = NULL; | 110 | struct file * interp_file = NULL; |
@@ -199,7 +199,7 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
199 | 199 | ||
200 | bprm->recursion_depth++; | 200 | bprm->recursion_depth++; |
201 | 201 | ||
202 | retval = search_binary_handler (bprm, regs); | 202 | retval = search_binary_handler(bprm); |
203 | if (retval < 0) | 203 | if (retval < 0) |
204 | goto _error; | 204 | goto _error; |
205 | 205 | ||
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index d3b8c1f63155..8c954997e7f7 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | 16 | ||
17 | static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) | 17 | static int load_script(struct linux_binprm *bprm) |
18 | { | 18 | { |
19 | const char *i_arg, *i_name; | 19 | const char *i_arg, *i_name; |
20 | char *cp; | 20 | char *cp; |
@@ -95,7 +95,7 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) | |||
95 | retval = prepare_binprm(bprm); | 95 | retval = prepare_binprm(bprm); |
96 | if (retval < 0) | 96 | if (retval < 0) |
97 | return retval; | 97 | return retval; |
98 | return search_binary_handler(bprm,regs); | 98 | return search_binary_handler(bprm); |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct linux_binfmt script_format = { | 101 | static struct linux_binfmt script_format = { |
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c index 4517aaff61b4..4e00ed68d4a6 100644 --- a/fs/binfmt_som.c +++ b/fs/binfmt_som.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include <linux/elf.h> | 36 | #include <linux/elf.h> |
37 | 37 | ||
38 | static int load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs); | 38 | static int load_som_binary(struct linux_binprm * bprm); |
39 | static int load_som_library(struct file *); | 39 | static int load_som_library(struct file *); |
40 | 40 | ||
41 | /* | 41 | /* |
@@ -180,13 +180,14 @@ out: | |||
180 | */ | 180 | */ |
181 | 181 | ||
182 | static int | 182 | static int |
183 | load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs) | 183 | load_som_binary(struct linux_binprm * bprm) |
184 | { | 184 | { |
185 | int retval; | 185 | int retval; |
186 | unsigned int size; | 186 | unsigned int size; |
187 | unsigned long som_entry; | 187 | unsigned long som_entry; |
188 | struct som_hdr *som_ex; | 188 | struct som_hdr *som_ex; |
189 | struct som_exec_auxhdr *hpuxhdr; | 189 | struct som_exec_auxhdr *hpuxhdr; |
190 | struct pt_regs *regs = current_pt_regs(); | ||
190 | 191 | ||
191 | /* Get the exec-header */ | 192 | /* Get the exec-header */ |
192 | som_ex = (struct som_hdr *) bprm->buf; | 193 | som_ex = (struct som_hdr *) bprm->buf; |
diff --git a/fs/coredump.c b/fs/coredump.c index ce47379bfa61..177493272a61 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -458,7 +458,7 @@ static int umh_pipe_setup(struct subprocess_info *info, struct cred *new) | |||
458 | return err; | 458 | return err; |
459 | } | 459 | } |
460 | 460 | ||
461 | void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) | 461 | void do_coredump(siginfo_t *siginfo) |
462 | { | 462 | { |
463 | struct core_state core_state; | 463 | struct core_state core_state; |
464 | struct core_name cn; | 464 | struct core_name cn; |
@@ -474,7 +474,7 @@ void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) | |||
474 | static atomic_t core_dump_count = ATOMIC_INIT(0); | 474 | static atomic_t core_dump_count = ATOMIC_INIT(0); |
475 | struct coredump_params cprm = { | 475 | struct coredump_params cprm = { |
476 | .siginfo = siginfo, | 476 | .siginfo = siginfo, |
477 | .regs = regs, | 477 | .regs = signal_pt_regs(), |
478 | .limit = rlimit(RLIMIT_CORE), | 478 | .limit = rlimit(RLIMIT_CORE), |
479 | /* | 479 | /* |
480 | * We must use the same mm->flags while dumping core to avoid | 480 | * We must use the same mm->flags while dumping core to avoid |
@@ -1349,7 +1349,7 @@ EXPORT_SYMBOL(remove_arg_zero); | |||
1349 | /* | 1349 | /* |
1350 | * cycle the list of binary formats handler, until one recognizes the image | 1350 | * cycle the list of binary formats handler, until one recognizes the image |
1351 | */ | 1351 | */ |
1352 | int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | 1352 | int search_binary_handler(struct linux_binprm *bprm) |
1353 | { | 1353 | { |
1354 | unsigned int depth = bprm->recursion_depth; | 1354 | unsigned int depth = bprm->recursion_depth; |
1355 | int try,retval; | 1355 | int try,retval; |
@@ -1374,13 +1374,13 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1374 | for (try=0; try<2; try++) { | 1374 | for (try=0; try<2; try++) { |
1375 | read_lock(&binfmt_lock); | 1375 | read_lock(&binfmt_lock); |
1376 | list_for_each_entry(fmt, &formats, lh) { | 1376 | list_for_each_entry(fmt, &formats, lh) { |
1377 | int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary; | 1377 | int (*fn)(struct linux_binprm *) = fmt->load_binary; |
1378 | if (!fn) | 1378 | if (!fn) |
1379 | continue; | 1379 | continue; |
1380 | if (!try_module_get(fmt->module)) | 1380 | if (!try_module_get(fmt->module)) |
1381 | continue; | 1381 | continue; |
1382 | read_unlock(&binfmt_lock); | 1382 | read_unlock(&binfmt_lock); |
1383 | retval = fn(bprm, regs); | 1383 | retval = fn(bprm); |
1384 | /* | 1384 | /* |
1385 | * Restore the depth counter to its starting value | 1385 | * Restore the depth counter to its starting value |
1386 | * in this call, so we don't have to rely on every | 1386 | * in this call, so we don't have to rely on every |
@@ -1439,8 +1439,7 @@ EXPORT_SYMBOL(search_binary_handler); | |||
1439 | */ | 1439 | */ |
1440 | static int do_execve_common(const char *filename, | 1440 | static int do_execve_common(const char *filename, |
1441 | struct user_arg_ptr argv, | 1441 | struct user_arg_ptr argv, |
1442 | struct user_arg_ptr envp, | 1442 | struct user_arg_ptr envp) |
1443 | struct pt_regs *regs) | ||
1444 | { | 1443 | { |
1445 | struct linux_binprm *bprm; | 1444 | struct linux_binprm *bprm; |
1446 | struct file *file; | 1445 | struct file *file; |
@@ -1524,7 +1523,7 @@ static int do_execve_common(const char *filename, | |||
1524 | if (retval < 0) | 1523 | if (retval < 0) |
1525 | goto out; | 1524 | goto out; |
1526 | 1525 | ||
1527 | retval = search_binary_handler(bprm,regs); | 1526 | retval = search_binary_handler(bprm); |
1528 | if (retval < 0) | 1527 | if (retval < 0) |
1529 | goto out; | 1528 | goto out; |
1530 | 1529 | ||
@@ -1566,19 +1565,17 @@ out_ret: | |||
1566 | 1565 | ||
1567 | int do_execve(const char *filename, | 1566 | int do_execve(const char *filename, |
1568 | const char __user *const __user *__argv, | 1567 | const char __user *const __user *__argv, |
1569 | const char __user *const __user *__envp, | 1568 | const char __user *const __user *__envp) |
1570 | struct pt_regs *regs) | ||
1571 | { | 1569 | { |
1572 | struct user_arg_ptr argv = { .ptr.native = __argv }; | 1570 | struct user_arg_ptr argv = { .ptr.native = __argv }; |
1573 | struct user_arg_ptr envp = { .ptr.native = __envp }; | 1571 | struct user_arg_ptr envp = { .ptr.native = __envp }; |
1574 | return do_execve_common(filename, argv, envp, regs); | 1572 | return do_execve_common(filename, argv, envp); |
1575 | } | 1573 | } |
1576 | 1574 | ||
1577 | #ifdef CONFIG_COMPAT | 1575 | #ifdef CONFIG_COMPAT |
1578 | int compat_do_execve(const char *filename, | 1576 | static int compat_do_execve(const char *filename, |
1579 | const compat_uptr_t __user *__argv, | 1577 | const compat_uptr_t __user *__argv, |
1580 | const compat_uptr_t __user *__envp, | 1578 | const compat_uptr_t __user *__envp) |
1581 | struct pt_regs *regs) | ||
1582 | { | 1579 | { |
1583 | struct user_arg_ptr argv = { | 1580 | struct user_arg_ptr argv = { |
1584 | .is_compat = true, | 1581 | .is_compat = true, |
@@ -1588,7 +1585,7 @@ int compat_do_execve(const char *filename, | |||
1588 | .is_compat = true, | 1585 | .is_compat = true, |
1589 | .ptr.compat = __envp, | 1586 | .ptr.compat = __envp, |
1590 | }; | 1587 | }; |
1591 | return do_execve_common(filename, argv, envp, regs); | 1588 | return do_execve_common(filename, argv, envp); |
1592 | } | 1589 | } |
1593 | #endif | 1590 | #endif |
1594 | 1591 | ||
@@ -1669,7 +1666,7 @@ SYSCALL_DEFINE3(execve, | |||
1669 | struct filename *path = getname(filename); | 1666 | struct filename *path = getname(filename); |
1670 | int error = PTR_ERR(path); | 1667 | int error = PTR_ERR(path); |
1671 | if (!IS_ERR(path)) { | 1668 | if (!IS_ERR(path)) { |
1672 | error = do_execve(path->name, argv, envp, current_pt_regs()); | 1669 | error = do_execve(path->name, argv, envp); |
1673 | putname(path); | 1670 | putname(path); |
1674 | } | 1671 | } |
1675 | return error; | 1672 | return error; |
@@ -1682,8 +1679,7 @@ asmlinkage long compat_sys_execve(const char __user * filename, | |||
1682 | struct filename *path = getname(filename); | 1679 | struct filename *path = getname(filename); |
1683 | int error = PTR_ERR(path); | 1680 | int error = PTR_ERR(path); |
1684 | if (!IS_ERR(path)) { | 1681 | if (!IS_ERR(path)) { |
1685 | error = compat_do_execve(path->name, argv, envp, | 1682 | error = compat_do_execve(path->name, argv, envp); |
1686 | current_pt_regs()); | ||
1687 | putname(path); | 1683 | putname(path); |
1688 | } | 1684 | } |
1689 | return error; | 1685 | return error; |
@@ -1696,12 +1692,9 @@ int kernel_execve(const char *filename, | |||
1696 | const char *const argv[], | 1692 | const char *const argv[], |
1697 | const char *const envp[]) | 1693 | const char *const envp[]) |
1698 | { | 1694 | { |
1699 | struct pt_regs *p = current_pt_regs(); | 1695 | int ret = do_execve(filename, |
1700 | int ret; | ||
1701 | |||
1702 | ret = do_execve(filename, | ||
1703 | (const char __user *const __user *)argv, | 1696 | (const char __user *const __user *)argv, |
1704 | (const char __user *const __user *)envp, p); | 1697 | (const char __user *const __user *)envp); |
1705 | if (ret < 0) | 1698 | if (ret < 0) |
1706 | return ret; | 1699 | return ret; |
1707 | 1700 | ||
@@ -1709,6 +1702,6 @@ int kernel_execve(const char *filename, | |||
1709 | * We were successful. We won't be returning to our caller, but | 1702 | * We were successful. We won't be returning to our caller, but |
1710 | * instead to user space by manipulating the kernel stack. | 1703 | * instead to user space by manipulating the kernel stack. |
1711 | */ | 1704 | */ |
1712 | ret_from_kernel_execve(p); | 1705 | ret_from_kernel_execve(current_pt_regs()); |
1713 | } | 1706 | } |
1714 | #endif | 1707 | #endif |
@@ -519,12 +519,6 @@ struct files_struct init_files = { | |||
519 | .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), | 519 | .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), |
520 | }; | 520 | }; |
521 | 521 | ||
522 | void daemonize_descriptors(void) | ||
523 | { | ||
524 | atomic_inc(&init_files.count); | ||
525 | reset_files_struct(&init_files); | ||
526 | } | ||
527 | |||
528 | /* | 522 | /* |
529 | * allocate a file descriptor, mark it busy. | 523 | * allocate a file descriptor, mark it busy. |
530 | */ | 524 | */ |
diff --git a/fs/fs_struct.c b/fs/fs_struct.c index 5df4775fea03..fe6ca583bbc0 100644 --- a/fs/fs_struct.c +++ b/fs/fs_struct.c | |||
@@ -164,27 +164,3 @@ struct fs_struct init_fs = { | |||
164 | .seq = SEQCNT_ZERO, | 164 | .seq = SEQCNT_ZERO, |
165 | .umask = 0022, | 165 | .umask = 0022, |
166 | }; | 166 | }; |
167 | |||
168 | void daemonize_fs_struct(void) | ||
169 | { | ||
170 | struct fs_struct *fs = current->fs; | ||
171 | |||
172 | if (fs) { | ||
173 | int kill; | ||
174 | |||
175 | task_lock(current); | ||
176 | |||
177 | spin_lock(&init_fs.lock); | ||
178 | init_fs.users++; | ||
179 | spin_unlock(&init_fs.lock); | ||
180 | |||
181 | spin_lock(&fs->lock); | ||
182 | current->fs = &init_fs; | ||
183 | kill = !--fs->users; | ||
184 | spin_unlock(&fs->lock); | ||
185 | |||
186 | task_unlock(current); | ||
187 | if (kill) | ||
188 | free_fs_struct(fs); | ||
189 | } | ||
190 | } | ||