Commit cdcb3f81 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Yongqin Liu
Browse files

UPSTREAM: soc: qcom: mdt_loader: Deal with zero e_shentsize



commit 25daf9af upstream.

Firmware that doesn't provide section headers leave both e_shentsize and
e_shnum 0, which obvious isn't compatible with the newly introduced
stricter checks.

Make the section-related checks conditional on either of these values
being non-zero.

Fixes: 9f9967fe ("soc: qcom: mdt_loader: Ensure we don't read past the ELF header")
Reported-by: default avatarVal Packett <val@packett.cool>
Closes: https://lore.kernel.org/all/ece307c3-7d65-440f-babd-88cf9705b908@packett.cool/


Reported-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Closes: https://lore.kernel.org/all/aec9cd03-6fc2-4dc8-b937-8b7cf7bf4128@linaro.org/


Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Fixes: 9f35ab0e ("soc: qcom: mdt_loader: Fix error return values in mdt_header_valid()")
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250730-mdt-loader-shentsize-zero-v1-1-04f43186229c@oss.qualcomm.com


Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
Cc: Yongqin Liu <yongqin.liu@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 146449535
Change-Id: Iacfaffd1094a328aa884e08b99d42b45fe7e8c3f
(cherry picked from commit 64faf7d6
from the upstream 5.4 lts branch of linux-5.4.y)
Signed-off-by: default avatarYongqin Liu <yongqin.liu@linaro.org>
parent d1c28b38
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment