aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_flat.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_flat.c')
-rw-r--r--fs/binfmt_flat.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 82a48e830018..e4b59e76afb0 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -856,9 +856,14 @@ err:
856 856
857static int load_flat_shared_library(int id, struct lib_info *libs) 857static int load_flat_shared_library(int id, struct lib_info *libs)
858{ 858{
859 /*
860 * This is a fake bprm struct; only the members "buf", "file" and
861 * "filename" are actually used.
862 */
859 struct linux_binprm bprm; 863 struct linux_binprm bprm;
860 int res; 864 int res;
861 char buf[16]; 865 char buf[16];
866 loff_t pos = 0;
862 867
863 memset(&bprm, 0, sizeof(bprm)); 868 memset(&bprm, 0, sizeof(bprm));
864 869
@@ -872,25 +877,11 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
872 if (IS_ERR(bprm.file)) 877 if (IS_ERR(bprm.file))
873 return res; 878 return res;
874 879
875 bprm.cred = prepare_exec_creds(); 880 res = kernel_read(bprm.file, bprm.buf, BINPRM_BUF_SIZE, &pos);
876 res = -ENOMEM;
877 if (!bprm.cred)
878 goto out;
879
880 /* We don't really care about recalculating credentials at this point
881 * as we're past the point of no return and are dealing with shared
882 * libraries.
883 */
884 bprm.called_set_creds = 1;
885 881
886 res = prepare_binprm(&bprm); 882 if (res >= 0)
887
888 if (!res)
889 res = load_flat_file(&bprm, libs, id, NULL); 883 res = load_flat_file(&bprm, libs, id, NULL);
890 884
891 abort_creds(bprm.cred);
892
893out:
894 allow_write_access(bprm.file); 885 allow_write_access(bprm.file);
895 fput(bprm.file); 886 fput(bprm.file);
896 887