From: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
To: Youssef Samir <quic_yabdulra@quicinc.com>,
manivannan.sadhasivam@linaro.org, quic_carlv@quicinc.com,
quic_thanson@quicinc.com
Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] bus: mhi: host: Detect events pointing to unexpected TREs
Date: Wed, 21 May 2025 10:39:54 -0600 [thread overview]
Message-ID: <d88aed39-b142-4ae7-a8fc-581e24ed6ebe@oss.qualcomm.com> (raw)
In-Reply-To: <20250521163110.571893-1-quic_yabdulra@quicinc.com>
On 5/21/2025 10:31 AM, Youssef Samir wrote:
> When a remote device sends a completion event to the host, it contains a
> pointer to the consumed TRE. The host uses this pointer to process all of
> the TREs between it and the host's local copy of the ring's read pointer.
> This works when processing completion for chained transactions, but can
> lead to nasty results if the device sends an event for a single-element
> transaction with a read pointer that is multiple elements ahead of the
> host's read pointer.
>
> For instance, if the host accesses an event ring while the device is
> updating it, the pointer inside of the event might still point to an old
> TRE. If the host uses the channel's xfer_cb() to directly free the buffer
> pointed to by the TRE, the buffer will be double-freed.
>
> Validate the pointer inside an event before processing it.
>
> Fixes: 1d3173a3bae7 ("bus: mhi: core: Add support for processing events from client device")
> Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com>
Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
next prev parent reply other threads:[~2025-05-21 16:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 16:31 [PATCH] bus: mhi: host: Detect events pointing to unexpected TREs Youssef Samir
2025-05-21 16:39 ` Jeff Hugo [this message]
2025-06-17 10:24 ` Manivannan Sadhasivam
2025-07-02 15:06 ` Youssef Samir
2025-07-08 13:26 ` Manivannan Sadhasivam
2025-07-08 17:18 ` Jeff Hugo
2025-07-09 11:08 ` Manivannan Sadhasivam
2025-07-09 14:32 ` Jeff Hugo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d88aed39-b142-4ae7-a8fc-581e24ed6ebe@oss.qualcomm.com \
--to=jeff.hugo@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mhi@lists.linux.dev \
--cc=quic_carlv@quicinc.com \
--cc=quic_thanson@quicinc.com \
--cc=quic_yabdulra@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox