Commit 6f18d174 authored by Sumit Kumar's avatar Sumit Kumar Committed by Mani Sadhasivam
Browse files

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: bbdcba57 ("bus: mhi: ep: Add support for ring management")
cc: stable@vger.kernel.org
Co-developed-by: default avatarYoussef Samir <quic_yabdulra@quicinc.com>
Signed-off-by: default avatarYoussef Samir <quic_yabdulra@quicinc.com>
Signed-off-by: default avatarSumit Kumar <quic_sumk@quicinc.com>
Reviewed-by: default avatarJeff Hugo <jeff.hugo@oss.qualcomm.com>
Reviewed-by: default avatarKrishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://patch.msgid.link/20250409-rp_fix-v1-1-8cf1fa22ed28@quicinc.com


Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
parent 0af2f6be
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment