Skip to content

Commit e6e7099

Browse files
committed
Merge tag 'qcom-drivers-fixes-for-6.17' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into arm/fixes
Qualcomm driver fixes for v6.17-rc1 The recently extended sanity checks for the Qualcomm firmware files turned out to be too restrictive, preventing a variety of firmware images from being loaded. Adjust the checks to allow section header sizes of 0 when sections aren't used. * tag 'qcom-drivers-fixes-for-6.17' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: soc: qcom: mdt_loader: Deal with zero e_shentsize Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 1b237f1 + 25daf9a commit e6e7099

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/soc/qcom/mdt_loader.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ static bool mdt_header_valid(const struct firmware *fw)
3939
if (phend > fw->size)
4040
return false;
4141

42-
if (ehdr->e_shentsize != sizeof(struct elf32_shdr))
43-
return false;
42+
if (ehdr->e_shentsize || ehdr->e_shnum) {
43+
if (ehdr->e_shentsize != sizeof(struct elf32_shdr))
44+
return false;
4445

45-
shend = size_add(size_mul(sizeof(struct elf32_shdr), ehdr->e_shnum), ehdr->e_shoff);
46-
if (shend > fw->size)
47-
return false;
46+
shend = size_add(size_mul(sizeof(struct elf32_shdr), ehdr->e_shnum), ehdr->e_shoff);
47+
if (shend > fw->size)
48+
return false;
49+
}
4850

4951
return true;
5052
}

0 commit comments

Comments
 (0)