]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
soc: qcom: mdt_loader: Ensure we don't read past the ELF header
authorBjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Fri, 22 Aug 2025 17:20:05 +0000 (13:20 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:26:15 +0000 (16:26 +0200)
commit43d26997d88c4056fce0324e72f62556bc7e8e8d
tree209af8622a5d5888ee106393f9d58a50228263e0
parent321896eee38f272def3f77fd89a9820777dc650d
soc: qcom: mdt_loader: Ensure we don't read past the ELF header

[ Upstream commit 9f9967fed9d066ed3dae9372b45ffa4f6fccfeef ]

When the MDT loader is used in remoteproc, the ELF header is sanitized
beforehand, but that's not necessary the case for other clients.

Validate the size of the firmware buffer to ensure that we don't read
past the end as we iterate over the header. e_phentsize and e_shentsize
are validated as well, to ensure that the assumptions about step size in
the traversal are valid.

Fixes: 2aad40d911ee ("remoteproc: Move qcom_mdt_loader into drivers/soc/qcom")
Cc: stable@vger.kernel.org
Reported-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250610-mdt-loader-validation-and-fixes-v2-1-f7073e9ab899@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/soc/qcom/mdt_loader.c