diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-09 03:02:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-09 03:02:35 -0400 |
commit | 1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee (patch) | |
tree | 47da3feee8e263e8c9352c85cf518e624be3c211 /fs/binfmt_script.c | |
parent | 750b1a6894ecc9b178c6e3d0a1170122971b2036 (diff) | |
parent | 8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff) |
Merge 4.14-rc4 into staging-next
We want the staging/iio fixes in here as well to handle merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/binfmt_script.c')
-rw-r--r-- | fs/binfmt_script.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index afdf4e3cafc2..7cde3f46ad26 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c | |||
@@ -19,7 +19,6 @@ static int load_script(struct linux_binprm *bprm) | |||
19 | const char *i_arg, *i_name; | 19 | const char *i_arg, *i_name; |
20 | char *cp; | 20 | char *cp; |
21 | struct file *file; | 21 | struct file *file; |
22 | char interp[BINPRM_BUF_SIZE]; | ||
23 | int retval; | 22 | int retval; |
24 | 23 | ||
25 | if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) | 24 | if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) |
@@ -55,7 +54,7 @@ static int load_script(struct linux_binprm *bprm) | |||
55 | break; | 54 | break; |
56 | } | 55 | } |
57 | for (cp = bprm->buf+2; (*cp == ' ') || (*cp == '\t'); cp++); | 56 | for (cp = bprm->buf+2; (*cp == ' ') || (*cp == '\t'); cp++); |
58 | if (*cp == '\0') | 57 | if (*cp == '\0') |
59 | return -ENOEXEC; /* No interpreter name found */ | 58 | return -ENOEXEC; /* No interpreter name found */ |
60 | i_name = cp; | 59 | i_name = cp; |
61 | i_arg = NULL; | 60 | i_arg = NULL; |
@@ -65,7 +64,6 @@ static int load_script(struct linux_binprm *bprm) | |||
65 | *cp++ = '\0'; | 64 | *cp++ = '\0'; |
66 | if (*cp) | 65 | if (*cp) |
67 | i_arg = cp; | 66 | i_arg = cp; |
68 | strcpy (interp, i_name); | ||
69 | /* | 67 | /* |
70 | * OK, we've parsed out the interpreter name and | 68 | * OK, we've parsed out the interpreter name and |
71 | * (optional) argument. | 69 | * (optional) argument. |
@@ -80,24 +78,27 @@ static int load_script(struct linux_binprm *bprm) | |||
80 | if (retval) | 78 | if (retval) |
81 | return retval; | 79 | return retval; |
82 | retval = copy_strings_kernel(1, &bprm->interp, bprm); | 80 | retval = copy_strings_kernel(1, &bprm->interp, bprm); |
83 | if (retval < 0) return retval; | 81 | if (retval < 0) |
82 | return retval; | ||
84 | bprm->argc++; | 83 | bprm->argc++; |
85 | if (i_arg) { | 84 | if (i_arg) { |
86 | retval = copy_strings_kernel(1, &i_arg, bprm); | 85 | retval = copy_strings_kernel(1, &i_arg, bprm); |
87 | if (retval < 0) return retval; | 86 | if (retval < 0) |
87 | return retval; | ||
88 | bprm->argc++; | 88 | bprm->argc++; |
89 | } | 89 | } |
90 | retval = copy_strings_kernel(1, &i_name, bprm); | 90 | retval = copy_strings_kernel(1, &i_name, bprm); |
91 | if (retval) return retval; | 91 | if (retval) |
92 | return retval; | ||
92 | bprm->argc++; | 93 | bprm->argc++; |
93 | retval = bprm_change_interp(interp, bprm); | 94 | retval = bprm_change_interp(i_name, bprm); |
94 | if (retval < 0) | 95 | if (retval < 0) |
95 | return retval; | 96 | return retval; |
96 | 97 | ||
97 | /* | 98 | /* |
98 | * OK, now restart the process with the interpreter's dentry. | 99 | * OK, now restart the process with the interpreter's dentry. |
99 | */ | 100 | */ |
100 | file = open_exec(interp); | 101 | file = open_exec(i_name); |
101 | if (IS_ERR(file)) | 102 | if (IS_ERR(file)) |
102 | return PTR_ERR(file); | 103 | return PTR_ERR(file); |
103 | 104 | ||