lkml.org 
[lkml]   [2009]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] FLAT: fix uninitialized ptr with shared libs
Date
From: Bernd Schmidt <bernds_cb1@t-online.de>

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

Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: David Howells <dhowells@redhat.com>
---
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


\
 
 \ /
  Last update: 2009-06-22 21:39    [from the cache]
©2003-2011 Jasper Spaans