Skip to content
Snippets Groups Projects
Commit 52a31837 authored by Dennis Cagle's avatar Dennis Cagle Committed by Stuart Scott
Browse files

soc: qcom: pil: Avoid possible buffer overflow during Modem boot


Buffer overflow can occur if MBA firmware size exceeds 1MB.
So validate size before copying the firmware.

Bug: 34112490
CRs-Fixed: 2001803
Change-Id: I070ddf85fbc47df072e7258369272366262ebf46
Signed-off-by: default avatarKishor PK <kpbhat@codeaurora.org>
Signed-off-by: default avatarDennis Cagle <d-cagle@codeaurora.org>
parent 7235a048
No related branches found
No related tags found
No related merge requests found
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
...@@ -477,7 +477,16 @@ int pil_mss_reset_load_mba(struct pil_desc *pil) ...@@ -477,7 +477,16 @@ int pil_mss_reset_load_mba(struct pil_desc *pil)
goto err_mss_reset; goto err_mss_reset;
} }
count = fw->size; count = fw->size;
if (count <= SZ_1M) {
/* Ensures memcpy is done for max 1MB fw size */
memcpy(mba_virt, data, count); memcpy(mba_virt, data, count);
} else {
dev_err(pil->dev, "%s fw image loading into memory is failed due to fw size overflow\n",
__func__);
ret = -EINVAL;
goto err_mss_reset;
}
/* Ensure memcpy of the MBA memory is done before loading the DP */
wmb(); wmb();
ret = pil_mss_reset(pil); ret = pil_mss_reset(pil);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment