diff options
author | Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> | 2021-06-29 17:32:49 +0200 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2021-07-19 22:20:55 +0200 |
commit | a89f355e469dcda129c2522be4fdba00c1c74c83 (patch) | |
tree | ba5406274294728e2537e7763d1045e8b5e8257e /drivers/zorro | |
parent | firmware: qcom_scm: Allow qcom_scm driver to be loadable as a permenent module (diff) | |
download | linux-a89f355e469dcda129c2522be4fdba00c1c74c83.tar.xz linux-a89f355e469dcda129c2522be4fdba00c1c74c83.zip |
soc: qcom: aoss: Fix the out of bound usage of cooling_devs
In "qmp_cooling_devices_register", the count value is initially
QMP_NUM_COOLING_RESOURCES, which is 2. Based on the initial count value,
the memory for cooling_devs is allocated. Then while calling the
"qmp_cooling_device_add" function, count value is post-incremented for
each child node.
This makes the out of bound access to the cooling_dev array. Fix it by
passing the QMP_NUM_COOLING_RESOURCES definition to devm_kzalloc() and
initializing the count to 0.
While at it, let's also free the memory allocated to cooling_dev if no
cooling device is found in DT and during unroll phase.
Cc: stable@vger.kernel.org # 5.4
Fixes: 05589b30b21a ("soc: qcom: Extend AOSS QMP driver to support resources that are used to wake up the SoC.")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20210629153249.73428-1-manivannan.sadhasivam@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/zorro')
0 files changed, 0 insertions, 0 deletions