From 0c22f7b341dab0c9c43f8f94aa62b78d982702e4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 6 Aug 2009 15:09:34 -0700 Subject: [PATCH] --- yaml --- r: 156434 b: refs/heads/master c: 3440625d78711bee41a84cf29c3d8c579b522666 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/binfmt_flat.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 3b7981614367..4f9b040c95a0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9e5cf0ca2e9b65110ae5f094d7f0f7165cd1bbbb +refs/heads/master: 3440625d78711bee41a84cf29c3d8c579b522666 diff --git a/trunk/fs/binfmt_flat.c b/trunk/fs/binfmt_flat.c index 697f6b5f1313..e92f229e3c6e 100644 --- a/trunk/fs/binfmt_flat.c +++ b/trunk/fs/binfmt_flat.c @@ -828,15 +828,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); }