[PATCH] FLAT: fix uninitialized ptr with shared libs

From: Mike Frysinger
Date: Mon Jun 22 2009 - 15:36:05 EST


From: Bernd Schmidt <bernds_cb1@xxxxxxxxxxx>

The new credentials code broke load_flat_shared_library() as it now uses
an uninitialized cred pointer.

Signed-off-by: Bernd Schmidt <bernds_cb1@xxxxxxxxxxx>
Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
Acked-by: David Howells <dhowells@xxxxxxxxxx>
---
should be cleaned up to apply to the master branch

fs/binfmt_flat.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 697f6b5..33283cd 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -824,14 +824,23 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
/* Open the file up */
bprm.filename = buf;
bprm.file = open_exec(bprm.filename);
+ bprm.cred = NULL;
res = PTR_ERR(bprm.file);
if (IS_ERR(bprm.file))
return res;

+ bprm.cred = prepare_exec_creds();
+ if (!bprm.cred)
+ goto out;
+
res = prepare_binprm(&bprm);

if (res <= (unsigned long)-4096)
res = load_flat_file(&bprm, libs, id, NULL);
+ out:
+ if (bprm.cred)
+ abort_creds(bprm.cred);
+
if (bprm.file) {
allow_write_access(bprm.file);
fput(bprm.file);
--
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/