mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
CRED: Fix load_flat_shared_library() to initialise bprm correctly
Fix binfmt_flag's load_flat_shared_library() to initialise bprm correctly. Currently, prepare_binprm() is called with only .filename .file and .cred fields set in bprm, but the .cred_prepared and .per_clear fields at least need initialising. Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
parent
db5ca356d8
commit
3a852d3bd5
@ -820,6 +820,8 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
|
||||
int res;
|
||||
char buf[16];
|
||||
|
||||
memset(&bprm, 0, sizeof(bprm));
|
||||
|
||||
/* Create the file name */
|
||||
sprintf(buf, "/lib/lib%d.so", id);
|
||||
|
||||
@ -835,6 +837,12 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
|
||||
if (!bprm.cred)
|
||||
goto out;
|
||||
|
||||
/* We don't really care about recalculating credentials at this point
|
||||
* as we're past the point of no return and are dealing with shared
|
||||
* libraries.
|
||||
*/
|
||||
bprm.cred_prepared = 1;
|
||||
|
||||
res = prepare_binprm(&bprm);
|
||||
|
||||
if (!IS_ERR_VALUE(res))
|
||||
|
Loading…
Reference in New Issue
Block a user