diff options
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1175,9 +1175,24 @@ void free_bprm(struct linux_binprm *bprm) | |||
1175 | mutex_unlock(¤t->signal->cred_guard_mutex); | 1175 | mutex_unlock(¤t->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 | ||
1184 | int 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 | } | ||
1194 | EXPORT_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 | */ |