summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator/iter.rs
diff options
context:
space:
mode:
authorSumit Kumar <sumit.kumar@oss.qualcomm.com>2025-09-10 18:11:09 +0530
committerManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>2025-09-12 16:08:41 +0530
commitf5225a34bd8f9f64eec37f6ae1461289aaa3eb86 (patch)
tree16fe4808bdd391eb203e5f97f5c88f4195ff32d6 /rust/kernel/alloc/allocator/iter.rs
parentd5411ed6cabd376468f76584b1fe75235325966c (diff)
bus: mhi: ep: Fix chained transfer handling in read path
The mhi_ep_read_channel function incorrectly assumes the End of Transfer (EOT) bit is present for each packet in a chained transactions, causing it to advance mhi_chan->rd_offset beyond wr_offset during host-to-device transfers when EOT has not yet arrived. This leads to access of unmapped host memory, causing IOMMU faults and processing of stale TREs. Modify the loop condition to ensure mhi_queue is not empty, allowing the function to process only valid TREs up to the current write pointer to prevent premature reads and ensure safe traversal of chained TREs. Due to this change, buf_left needs to be removed from the while loop condition to avoid exiting prematurely before reading the ring completely, and also remove write_offset since it will always be zero because the new cache buffer is allocated every time. Fixes: 5301258899773 ("bus: mhi: ep: Add support for reading from the host") Co-developed-by: Akhil Vinod <akhil.vinod@oss.qualcomm.com> Signed-off-by: Akhil Vinod <akhil.vinod@oss.qualcomm.com> Signed-off-by: Sumit Kumar <sumit.kumar@oss.qualcomm.com> [mani: reworded description slightly] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20250910-final_chained-v3-1-ec77c9d88ace@oss.qualcomm.com
Diffstat (limited to 'rust/kernel/alloc/allocator/iter.rs')
0 files changed, 0 insertions, 0 deletions