aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index d8e1191cb112..237d5342786c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1175,9 +1175,24 @@ void free_bprm(struct linux_binprm *bprm)
1175 mutex_unlock(&current->signal->cred_guard_mutex); 1175 mutex_unlock(&current->signal->cred_guard_mutex);
1176 abort_creds(bprm->cred); 1176 abort_creds(bprm->cred);
1177 } 1177 }
1178 /* If a binfmt changed the interp, free it. */
1179 if (bprm->interp != bprm->filename)
1180 kfree(bprm->interp);
1178 kfree(bprm); 1181 kfree(bprm);
1179} 1182}
1180 1183
1184int bprm_change_interp(char *interp, struct linux_binprm *bprm)
1185{
1186 /* If a binfmt changed the interp, free it first. */
1187 if (bprm->interp != bprm->filename)
1188 kfree(bprm->interp);
1189 bprm->interp = kstrdup(interp, GFP_KERNEL);
1190 if (!bprm->interp)
1191 return -ENOMEM;
1192 return 0;
1193}
1194EXPORT_SYMBOL(bprm_change_interp);
1195
1181/* 1196/*
1182 * install the new credentials for this executable 1197 * install the new credentials for this executable
1183 */ 1198 */