aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authormspector <mspector@google.com>2017-01-26 17:10:17 -0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:35:13 +0200
commit8433efcc876aab9c0f2495d8d5a288c2e99b4308 (patch)
treef539f6c33669e8b13d50609d49d6a3874cb54d5f /fs
parentbc38a40815a6221528df225f5696c3ac06c01655 (diff)
ANDROID: Fixing incorrect return value on error
This fixes an incorrect return value from should_call_arch_setup_additional_pages when kernel_read returns a different length than expected, the length is returned. The fix is to return -EIO instead. Signed-off-by: mspector <mspector@google.com> Bug: 34749002 Change-Id: I484ad801ce114b4dfe9f62b8b83c960cb693c9b6
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_elf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 61e0e47ea..cd843472f 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -605,12 +605,16 @@ static int should_call_arch_setup_additional_pages(struct linux_binprm *bprm,
retval = kernel_read(bprm->file, elf_ppnt->p_offset,
(char *)elf_pnotes, elf_ppnt->p_filesz);
- if ((retval < 0) ||
- ((Elf64_Xword) retval != elf_ppnt->p_filesz)) {
+ if (retval < 0) {
kfree(elf_pnotes);
return retval;
}
+ if((Elf64_Xword) retval != elf_ppnt->p_filesz) {
+ kfree(elf_pnotes);
+ return -EIO;
+ }
+
/*
* Now that we have read in all the notes and find ours
*/