From: "Lakshmi Sowjanya D (QUIC)" <quic_laksd@quicinc.com>
To: Gabor Juhos <j4g8y7@gmail.com>,
"Md Sadre Alam (QUIC)" <quic_mdalam@quicinc.com>,
Mark Brown <broonie@kernel.org>,
"Varadarajan Narayanan (QUIC)" <quic_varada@quicinc.com>,
"Sricharan Ramabadhran (QUIC)" <quic_srichara@quicinc.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Cc: "linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2/2] mtd: nand: qpic_common: prevent out of bounds access of BAM arrays
Date: Wed, 28 May 2025 06:11:17 +0000 [thread overview]
Message-ID: <f467dcc6e92149b8b46ca8a879d36d6c@quicinc.com> (raw)
In-Reply-To: <b9134a1d-3dbc-4cd9-b22a-90b1c8934ce9@gmail.com>
> -----Original Message-----
> From: Gabor Juhos <j4g8y7@gmail.com>
> Sent: Tuesday, May 27, 2025 1:31 AM
> To: Md Sadre Alam (QUIC) <quic_mdalam@quicinc.com>; Mark Brown
> <broonie@kernel.org>; Varadarajan Narayanan (QUIC)
> <quic_varada@quicinc.com>; Sricharan Ramabadhran (QUIC)
> <quic_srichara@quicinc.com>; Miquel Raynal <miquel.raynal@bootlin.com>;
> Richard Weinberger <richard@nod.at>; Vignesh Raghavendra
> <vigneshr@ti.com>
> Cc: linux-spi@vger.kernel.org; linux-mtd@lists.infradead.org; linux-arm-
> msm@vger.kernel.org; linux-kernel@vger.kernel.org; Lakshmi Sowjanya D
> (QUIC) <quic_laksd@quicinc.com>
> Subject: Re: [PATCH 2/2] mtd: nand: qpic_common: prevent out of bounds
> access of BAM arrays
>
> 2025. 05. 26. 8:53 keltezéssel, Md Sadre Alam írta:
> > Hi,
> >
> > On 5/25/2025 10:35 PM, Gabor Juhos wrote:
> >> The common QPIC code does not do any boundary checking when it
> >> handles the command elements and scatter gater list arrays of a BAM
> >> transaction, thus it allows to access out of bounds elements in those.
> >>
> >> Although it is the responsibility of the given driver to allocate
> >> enough space for all possible BAM transaction variations, however
> >> there can be mistakes in the driver code which can lead to hidden
> >> memory corruption issues which are hard to debug.
> >>
> >> This kind of problem has been observed during testing the 'spi-qpic-snand'
> >> driver. Although the driver has been fixed with a preceding patch,
> >> but it still makes sense to reduce the chance of having such errors again
> later.
> >>
> >> In order to prevent such errors, change the
> >> qcom_alloc_bam_transaction() function to store the number of elements
> >> of the arrays in the 'bam_transaction' strucutre during allocation.
> >> Also, add sanity checks to the qcom_prep_bam_dma_desc_{cmd,data}()
> >> functions to avoid using out of bounds indices for the arrays.
> >>
> >> Tested with the 'spi-qpic-snand' driver only.
> > I recommend testing this patch on both the IPQ and SDX platforms, as
> > the QPIC raw NAND driver are utilized across both.
> >
> > If you have access to IPQ and SDX devices with raw NAND, please
> > proceed with testing on both.
>
> Sorry, I have no SDX devices at all, and unfortunately I can't access my older
> IPQ boards before next week.
>
> >
> > Otherwise, I can handle testing on the IPQ raw NAND device and
> > coordinate with Lakshmi Sowjanya D (quic_laksd@quicinc.com) for
> > testing on the SDX platform.
>
> If you could do some testing in the meantime, that would be superb.
> Thanks for that in advance!
>
> Regards,
> Gabor
Tested-by: Lakshmi Sowjanya D <quic_laksd@quicinc.com> # on SDX75
--
Regards
Lakshmi Sowjanya
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2025-05-28 6:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-25 17:05 [PATCH 0/2] spi: spi-qpic-snand: avoid memory corruption Gabor Juhos
2025-05-25 17:05 ` [PATCH 1/2] spi: spi-qpic-snand: reallocate BAM transactions Gabor Juhos
2025-05-26 5:56 ` Md Sadre Alam
2025-05-27 11:28 ` Mark Brown
2025-05-27 12:23 ` Gabor Juhos
2025-05-25 17:05 ` [PATCH 2/2] mtd: nand: qpic_common: prevent out of bounds access of BAM arrays Gabor Juhos
2025-05-26 6:53 ` Md Sadre Alam
2025-05-26 20:01 ` Gabor Juhos
2025-05-28 6:11 ` Lakshmi Sowjanya D (QUIC) [this message]
2025-05-26 9:27 ` Miquel Raynal
2025-05-26 20:21 ` Gabor Juhos
2025-05-26 8:13 ` [PATCH 0/2] spi: spi-qpic-snand: avoid memory corruption Miquel Raynal
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=f467dcc6e92149b8b46ca8a879d36d6c@quicinc.com \
--to=quic_laksd@quicinc.com \
--cc=broonie@kernel.org \
--cc=j4g8y7@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=quic_mdalam@quicinc.com \
--cc=quic_srichara@quicinc.com \
--cc=quic_varada@quicinc.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.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