twx-linux/drivers/bus
Jeff Hugo 5f084993c9 bus: mhi: host: Fix race between unprepare and queue_buf
commit 0686a818d77a431fc3ba2fab4b46bbb04e8c9380 upstream.

A client driver may use mhi_unprepare_from_transfer() to quiesce
incoming data during the client driver's tear down. The client driver
might also be processing data at the same time, resulting in a call to
mhi_queue_buf() which will invoke mhi_gen_tre(). If mhi_gen_tre() runs
after mhi_unprepare_from_transfer() has torn down the channel, a panic
will occur due to an invalid dereference leading to a page fault.

This occurs because mhi_gen_tre() does not verify the channel state
after locking it. Fix this by having mhi_gen_tre() confirm the channel
state is valid, or return error to avoid accessing deinitialized data.

Cc: stable@vger.kernel.org # 6.8
Fixes: b89b6a863dd5 ("bus: mhi: host: Add spinlock to protect WP access when queueing TREs")
Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Reviewed-by: Youssef Samir <quic_yabdulra@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Troy Hanson <quic_thanson@quicinc.com>
Link: https://lore.kernel.org/r/20250306172913.856982-1-jeff.hugo@oss.qualcomm.com
[mani: added stable tag]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25 10:45:26 +02:00
..
fsl-mc ARM: SoC cleanups for 6.6 2023-08-30 16:49:40 -07:00
mhi bus: mhi: host: Fix race between unprepare and queue_buf 2025-04-25 10:45:26 +02:00
arm-cci.c
arm-integrator-lm.c bus: integrator-lm: fix OF node leak in probe() 2024-10-04 16:29:51 +02:00
brcmstb_gisb.c
bt1-apb.c
bt1-axi.c
da8xx-mstpri.c
hisi_lpc.c bus: Explicitly include correct DT includes 2023-08-12 10:31:01 +02:00
imx-weim.c bus: imx-weim: fix valid range check 2024-03-01 13:35:05 +01:00
intel-ixp4xx-eb.c bus: ixp4xx: fix IXP4XX_EXP_T1_MASK 2023-07-05 22:22:55 +02:00
Kconfig bus: tegra-aconnect: Update dependency to ARCH_TEGRA 2024-03-26 18:19:30 -04:00
Makefile
mips_cdmm.c
moxtet.c bus: moxtet: Add spi device table 2024-01-20 11:51:47 +01:00
mvebu-mbus.c
omap_l3_noc.c
omap_l3_noc.h
omap_l3_smx.c ARM: SoC cleanups for 6.6 2023-08-30 16:49:40 -07:00
omap_l3_smx.h
omap-ocp2scp.c
qcom-ebi2.c
qcom-ssc-block-bus.c
simple-pm-bus.c bus: Explicitly include correct DT includes 2023-08-12 10:31:01 +02:00
sun50i-de2.c
sunxi-rsb.c ARM: SoC cleanups for 6.6 2023-08-30 16:49:40 -07:00
tegra-aconnect.c
tegra-gmi.c bus: tegra-gmi: Convert to devm_platform_ioremap_resource() 2023-07-21 17:27:33 +02:00
ti-pwmss.c bus: Explicitly include correct DT includes 2023-08-12 10:31:01 +02:00
ti-sysc.c of: remove internal arguments from of_property_for_each_u32() 2025-02-08 09:51:51 +01:00
ts-nbus.c
uniphier-system-bus.c
vexpress-config.c bus: vexpress-config: Convert to devm_platform_ioremap_resource() 2023-07-13 14:38:44 +01:00