diff options
author | 2023-10-05 12:51:34 -0700 | |
---|---|---|
committer | 2023-10-06 13:05:21 +0300 | |
commit | 60d2e1b37d530d6b1f8b7773cebaf8bbc1536b28 (patch) | |
tree | 290370d2b7599d99f3ca3b2b888a03e1438b5878 | |
parent | platform/x86/intel/ifs: Validate image size (diff) | |
download | linux-60d2e1b37d530d6b1f8b7773cebaf8bbc1536b28.tar.gz linux-60d2e1b37d530d6b1f8b7773cebaf8bbc1536b28.tar.bz2 linux-60d2e1b37d530d6b1f8b7773cebaf8bbc1536b28.zip |
platform/x86/intel/ifs: Metadata validation for start_chunk
Add an additional check to validate IFS image metadata field prior to
loading the test image.
If start_chunk is not a multiple of chunks_per_stride error out.
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Tested-by: Pengfei Xu <pengfei.xu@intel.com>
Link: https://lore.kernel.org/r/20231005195137.3117166-7-jithu.joseph@intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-rw-r--r-- | drivers/platform/x86/intel/ifs/load.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 582f1801aaaa..959b1878cae6 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -291,6 +291,13 @@ static int validate_ifs_metadata(struct device *dev) return ret; } + if (ifs_meta->chunks_per_stride && + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride != 0)) { + dev_warn(dev, "Starting chunk num %u not a multiple of chunks_per_stride %u\n", + ifs_meta->starting_chunk, ifs_meta->chunks_per_stride); + return ret; + } + return 0; } |