]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
phy: qcom-qmp: Ensure register indirection arrays initialized
authorBjorn Andersson <bjorn.andersson@linaro.org>
Fri, 15 May 2020 01:36:43 +0000 (18:36 -0700)
committerKishon Vijay Abraham I <kishon@ti.com>
Mon, 18 May 2020 14:00:56 +0000 (19:30 +0530)
commit72f039db491e59396edbaa39595d0865aee055ee
tree3e156f6a5e9547393e50165406466a46e7ffcae1
parent81530a38a36d411e01ea99116503901f75aa758b
phy: qcom-qmp: Ensure register indirection arrays initialized

It's possible that struct qmp_phy_cfg->regs references an array that is
smaller than the possible register lookups that is going to be
performed, with the resulting out-of-bounds read resulting in undefined
behavior.

One such example is when during qcom_qmp_phy_com_init() performs a
qphy_setbits() on entry QPHY_PCS_POWER_DOWN_CONTROL (i.e. 17) with
msm8996_ufsphy_regs_layout only being 12 entries long.

Solve this by inflating all "regs_layout" arrays to ensure that any
remaining entries are zero-initialized, as expected by the code.

Fixes: e4d8b05ad5f9 ("phy: qcom-qmp: Use proper PWRDOWN offset for sm8150 USB")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20200515013643.2081941-1-bjorn.andersson@linaro.org
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/qualcomm/phy-qcom-qmp.c