linux-loongson/drivers/bus/mhi/ep
Sumit Kumar 6f18d174b7 bus: mhi: ep: Update read pointer only after buffer is written
Inside mhi_ep_ring_add_element, the read pointer (rd_offset) is updated
before the buffer is written, potentially causing race conditions where
the host sees an updated read pointer before the buffer is actually
written. Updating rd_offset prematurely can lead to the host accessing
an uninitialized or incomplete element, resulting in data corruption.

Invoke the buffer write before updating rd_offset to ensure the element
is fully written before signaling its availability.

Fixes: bbdcba57a1 ("bus: mhi: ep: Add support for ring management")
cc: stable@vger.kernel.org
Co-developed-by: Youssef Samir <quic_yabdulra@quicinc.com>
Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com>
Signed-off-by: Sumit Kumar <quic_sumk@quicinc.com>
Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://patch.msgid.link/20250409-rp_fix-v1-1-8cf1fa22ed28@quicinc.com
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2025-04-24 10:34:51 +05:30
..
internal.h bus: mhi: ep: Add support for async DMA write operation 2023-12-15 14:20:03 +05:30
Kconfig
main.c Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
Makefile bus: mhi: ep: Add support for managing MHI state machine 2022-04-26 13:17:41 +02:00
mmio.c bus: mhi: ep: Add support for managing MMIO registers 2022-04-26 13:17:41 +02:00
ring.c bus: mhi: ep: Update read pointer only after buffer is written 2025-04-24 10:34:51 +05:30
sm.c bus: mhi: ep: Change state_lock to mutex 2023-01-27 12:31:41 +05:30