From: Jyothi Kumar Seerapu <jyothi.seerapu@oss.qualcomm.com>
To: Frank Li <Frank.li@oss.nxp.com>, sashiko-reviews@lists.linux.dev
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH 1/2] dmaengine: qcom-gpi: Add I2C High-Speed mode configuration support
Date: Wed, 26 Aug 2026 11:52:59 +0530 [thread overview]
Message-ID: <cb9a4cbb-b90b-4575-a08f-9695ed4c3461@oss.qualcomm.com> (raw)
In-Reply-To: <ao37oOa-EkMe5qXH@lizhi-Precision-Tower-5810>
On 8/26/2026 2:01 AM, Frank Li wrote:
> [Severity: High]
> When I2C High-Speed mode is used with both set_config and set_config1,
> can this cause an out-of-bounds write to the tre array?
>
> Looking at struct gpi_desc, the tre array is statically sized by MAX_TRE,
> which is defined as 3:
>
> #define MAX_TRE 3
>
> struct gpi_desc {
> ...
> struct gpi_tre tre[MAX_TRE];
> u32 num_tre;
> };
>
> If we generate CONFIG0, CONFIG1, GO, and DMA TREs, tre_idx will reach 3
> here. Writing to desc->tre[3] would overflow the array and overwrite the
> adjacent num_tre field.
>
> Later, gpi_prep_slave_sg() sets gpi_desc->num_tre = 4, which would
> overwrite the first 4 bytes of the newly written DMA TRE, potentially
> causing an IOMMU fault or bus error when the hardware attempts the transfer.
>
> Should MAX_TRE be increased to accommodate the new CONFIG1 TRE?
Thanks Frank Li, you're right — with both set_config and set_config1
set, we generate 4 TREs (CONFIG0 + CONFIG1 + GO + DMA), which overflows
the 3-slot tre[] array. Will bump MAX_TRE to 4 in v2.
next prev parent reply other threads:[~2026-08-26 6:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 11:25 [PATCH 0/2] i2c: Add I2C High-Speed mode support for qcom-geni Jyothi Kumar Seerapu
2026-08-24 11:25 ` [PATCH 1/2] dmaengine: qcom-gpi: Add I2C High-Speed mode configuration support Jyothi Kumar Seerapu
2026-08-24 11:36 ` sashiko-bot
2026-08-25 20:31 ` Frank Li
2026-08-26 6:22 ` Jyothi Kumar Seerapu [this message]
2026-08-24 11:25 ` [PATCH 2/2] i2c: qcom-geni: Add support for I2C High-Speed mode Jyothi Kumar Seerapu
2026-08-24 11:39 ` sashiko-bot
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=cb9a4cbb-b90b-4575-a08f-9695ed4c3461@oss.qualcomm.com \
--to=jyothi.seerapu@oss.qualcomm.com \
--cc=Frank.Li@kernel.org \
--cc=Frank.li@oss.nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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