aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-08-27 21:30:32 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-08-27 21:32:43 +0100
commitcf40141b515d518ff166afb85e898904ab2ae57a (patch)
tree03a0fa9ca3fd2e0a215a127b266b9fd0f6927077 /target/linux
parent97e32e9702be7c7fab97d024ee336886e9faa0c7 (diff)
downloadupstream-cf40141b515d518ff166afb85e898904ab2ae57a.tar.gz
upstream-cf40141b515d518ff166afb85e898904ab2ae57a.tar.bz2
upstream-cf40141b515d518ff166afb85e898904ab2ae57a.zip
kernel: properly handle paging errors in fit partition parser
The uImage.FIT partition uses page mapping without properly handling paging errors. This can lead to Kernel Oops in case of read errors while trying to parse uImage.FIT partitions. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/files/block/partitions/fit.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/target/linux/generic/files/block/partitions/fit.c b/target/linux/generic/files/block/partitions/fit.c
index 27e44a4af4..a0aa0eadf5 100644
--- a/target/linux/generic/files/block/partitions/fit.c
+++ b/target/linux/generic/files/block/partitions/fit.c
@@ -92,8 +92,11 @@ int parse_fit_partitions(struct parsed_partitions *state, u64 fit_start_sector,
return -ERANGE;
page = read_mapping_page(mapping, fit_start_sector >> (PAGE_SHIFT - SECTOR_SHIFT), NULL);
- if (!page)
- return -ENOMEM;
+ if (IS_ERR(page))
+ return -EFAULT;
+
+ if (PageError(page))
+ return -EFAULT;
init_fit = page_address(page);