This is a note to let you know that I've just added the patch titled soundwire: qcom: fix storing port config out-of-bounds to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: soundwire-qcom-fix-storing-port-config-out-of-bounds.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 490937d479abe5f6584e69b96df066bc87be92e9 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> Date: Thu, 1 Jun 2023 12:25:25 +0200 Subject: soundwire: qcom: fix storing port config out-of-bounds From: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> commit 490937d479abe5f6584e69b96df066bc87be92e9 upstream. The 'qcom_swrm_ctrl->pconfig' has size of QCOM_SDW_MAX_PORTS (14), however we index it starting from 1, not 0, to match real port numbers. This can lead to writing port config past 'pconfig' bounds and overwriting next member of 'qcom_swrm_ctrl' struct. Reported also by smatch: drivers/soundwire/qcom.c:1269 qcom_swrm_get_port_config() error: buffer overflow 'ctrl->pconfig' 14 <= 14 Fixes: 9916c02ccd74 ("soundwire: qcom: cleanup internal port config indexing") Cc: <stable@xxxxxxxxxxxxxxx> Reported-by: kernel test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <error27@xxxxxxxxx> Link: https://lore.kernel.org/r/202305201301.sCJ8UDKV-lkp@xxxxxxxxx/ Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230601102525.609627-1-krzysztof.kozlowski@xxxxxxxxxx Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/soundwire/qcom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -146,7 +146,8 @@ struct qcom_swrm_ctrl { u32 intr_mask; u8 rcmd_id; u8 wcmd_id; - struct qcom_swrm_port_config pconfig[QCOM_SDW_MAX_PORTS]; + /* Port numbers are 1 - 14 */ + struct qcom_swrm_port_config pconfig[QCOM_SDW_MAX_PORTS + 1]; struct sdw_stream_runtime *sruntime[SWRM_MAX_DAIS]; enum sdw_slave_status status[SDW_MAX_DEVICES + 1]; int (*reg_read)(struct qcom_swrm_ctrl *ctrl, int reg, u32 *val); Patches currently in stable-queue which might be from krzysztof.kozlowski@xxxxxxxxxx are queue-5.15/w1-w1_therm-fix-locking-behavior-in-convert_t.patch queue-5.15/memory-brcmstb_dpfe-fix-testing-array-offset-after-u.patch queue-5.15/arm64-dts-qcom-msm8916-correct-camss-unit-address.patch queue-5.15/arm64-dts-qcom-msm8994-correct-spmi-unit-address.patch queue-5.15/soundwire-qcom-fix-storing-port-config-out-of-bounds.patch queue-5.15/arm-dts-qcom-ipq4019-fix-broken-nand-controller-properties-override.patch queue-5.15/arm64-dts-qcom-sdm845-correct-camss-unit-address.patch queue-5.15/arm64-dts-microchip-sparx5-do-not-use-psci-on-refere.patch queue-5.15/arm64-dts-qcom-msm8996-correct-camss-unit-address.patch queue-5.15/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-when-iterating-clk.patch queue-5.15/nfc-llcp-fix-possible-use-of-uninitialized-variable-.patch queue-5.15/w1-fix-loop-in-w1_fini.patch queue-5.15/arm64-dts-qcom-sdm630-correct-camss-unit-address.patch queue-5.15/arm64-dts-qcom-apq8096-fix-fixed-regulator-name-prop.patch queue-5.15/tty-serial-samsung_tty-fix-a-memory-leak-in-s3c24xx_serial_getclk-in-case-of-error.patch