“28503cbbf32246466d45cb48c938d20c08b3ca1e”上不存在“test/git@gitcode.net:openanolis/dragonwell8_jdk.git”
提交 b744519d 编写于 作者: B Bjorn Andersson 提交者: Zheng Zengkai

soc: qcom: mdt_loader: Detect truncated read of segments

stable inclusion
from stable-5.10.37
commit d97cb4365747fdd36a7eacee2b89a80e6785ea97
bugzilla: 51868
CVE: NA

--------------------------------

[ Upstream commit 0648c55e ]

Given that no validation of how much data the firmware loader read in
for a given segment truncated segment files would best case result in a
hash verification failure, without any indication of what went wrong.

Improve this by validating that the firmware loader did return the
amount of data requested.

Fixes: 445c2410 ("soc: qcom: mdt_loader: Use request_firmware_into_buf()")
Reviewed-by: NSibi Sankar <sibis@codeaurora.org>
Link: https://lore.kernel.org/r/20210107232526.716989-1-bjorn.andersson@linaro.orgSigned-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d5b7a1ec
...@@ -261,6 +261,15 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, ...@@ -261,6 +261,15 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,
break; break;
} }
if (seg_fw->size != phdr->p_filesz) {
dev_err(dev,
"failed to load segment %d from truncated file %s\n",
i, fw_name);
release_firmware(seg_fw);
ret = -EINVAL;
break;
}
release_firmware(seg_fw); release_firmware(seg_fw);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册