diff options
-rw-r--r-- | fs/binfmt_flat.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index dfc0197905c..25200e66144 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c @@ -824,15 +824,22 @@ static int load_flat_shared_library(int id, struct lib_info *libs) if (IS_ERR(bprm.file)) return res; + bprm.cred = prepare_exec_creds(); + res = -ENOMEM; + if (!bprm.cred) + goto out; + res = prepare_binprm(&bprm); if (res <= (unsigned long)-4096) res = load_flat_file(&bprm, libs, id, NULL); - if (bprm.file) { - allow_write_access(bprm.file); - fput(bprm.file); - bprm.file = NULL; - } + + abort_creds(bprm.cred); + +out: + allow_write_access(bprm.file); + fput(bprm.file); + return(res); } |