lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250610113423.zztoyabv4qzsaawt@skbuf>
Date: Tue, 10 Jun 2025 14:34:23 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: James Clark <james.clark@...aro.org>
Cc: Vladimir Oltean <olteanv@...il.com>, Mark Brown <broonie@...nel.org>,
	linux-spi@...r.kernel.org, imx@...ts.linux.dev,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] spi: spi-fsl-dspi: Clear completion counter before
 initiating transfer

On Mon, Jun 09, 2025 at 04:32:38PM +0100, James Clark wrote:
> In target mode, extra interrupts can be received between the end of a
> transfer and halting the module if the host continues sending more data.

Presumably you mean not just any extra interrupts can be received, but
specifically CMDTCF, since that triggers the complete(&dspi->xfer_done)
call. Other interrupt sources are masked in XSPI mode and should be
irrelevant.

> If the interrupt from this occurs after the reinit_completion() then the
> completion counter is left at a non-zero value. The next unrelated
> transfer initiated by userspace will then complete immediately without
> waiting for the interrupt or writing to the RX buffer.
> 
> Fix it by resetting the counter before the transfer so that lingering
> values are cleared. This is done after clearing the FIFOs and the
> status register but before the transfer is initiated, so no interrupts
> should be received at this point resulting in other race conditions.

Sorry, I don't have a lot of experience with the target mode, and when I
introduced the XSPI FIFO mode, I didn't take target mode into consideration.

The question is, does the module support XSPI FIFO writes in target
mode? In the LS1028A reference manual, I see PUSHR_SLAVE has the upper
16 bits (for the command) hidden, specifically there is no CTAS field
there that would point to one of the CTARE0/CTARE1 registers.
Cross-checking with the S32G3 RM, I see nothing fundamentally different.

I am surprised, given this fact, that the CMDTCF interrupt would fire at
all in target mode.

> 
> Fixes: 4f5ee75ea171 ("spi: spi-fsl-dspi: Replace interruptible wait queue with a simple completion")

To be clear, if you ran 'git bisect' to track down this issue, it
wouldn't have pointed you to this commit, would it?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ