From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC3941AF0AF; Mon, 9 Feb 2026 14:35:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770647707; cv=none; b=YKDp0YvBt+vSkm/XrX4DHlmSbXARDJUMe56uMWE+1RQIJqwv5RB1pUW1+Bf6umgI2PYX53Ly1haaDD5Kn3aogmYcxAXw4M1gsTu3o5H5XYVi4jFh/SRdC6QTqjzDsfRUzU58IJ8xZnwgQav8Fc4WGFdLk6dtbJd48bV57yirM4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770647707; c=relaxed/simple; bh=1SXbW4Ad4erZpJ/Bmx26+DkrmWZoTvm09Rr0v+zu3gM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KPtwv3MbTDyjc96owj9G0UWse2R6xiZ+11NpI6JWPr7OmfcWAlNlqZoHTQpcQstfQjUyz+VwVVjyce4ONLww2Qx9wElV0d24In9UGWIuiXLxyYwxJcpF2hpWFP3snjSnIaLD7ry8nWqIBOvqTTA59sFK9pxyG3YGqB0Xeh2Okcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FRZT3L0p; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FRZT3L0p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 008EDC116C6; Mon, 9 Feb 2026 14:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770647707; bh=1SXbW4Ad4erZpJ/Bmx26+DkrmWZoTvm09Rr0v+zu3gM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRZT3L0pU8m7Rf5bYSzJjvdupYE6rwvsIIf11VUnuG63ka259l8vc4c0u0NgrdF3x pPJqH9+EejjfXDEaIdjKiJFSt7TOuq9htBX9W/+dJwYpc4Cx5zXsmgKO8jdj9WjvLd 3ix8aX+/+fTve4vpQtkvnHPuA21Ui6mFD95B6azk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Breno Leitao , Thierry Reding , Jon Hunter , Mark Brown , Sasha Levin Subject: [PATCH 6.18 166/175] spi: tegra210-quad: Move curr_xfer read inside spinlock Date: Mon, 9 Feb 2026 15:23:59 +0100 Message-ID: <20260209142326.458064682@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142320.474120190@linuxfoundation.org> References: <20260209142320.474120190@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Breno Leitao [ Upstream commit ef13ba357656451d6371940d8414e3e271df97e3 ] Move the assignment of the transfer pointer from curr_xfer inside the spinlock critical section in both handle_cpu_based_xfer() and handle_dma_based_xfer(). Previously, curr_xfer was read before acquiring the lock, creating a window where the timeout path could clear curr_xfer between reading it and using it. By moving the read inside the lock, the handlers are guaranteed to see a consistent value that cannot be modified by the timeout path. Fixes: 921fc1838fb0 ("spi: tegra210-quad: Add support for Tegra210 QSPI controller") Signed-off-by: Breno Leitao Acked-by: Thierry Reding Tested-by: Jon Hunter Acked-by: Jon Hunter Link: https://patch.msgid.link/20260126-tegra_xfer-v2-2-6d2115e4f387@debian.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-tegra210-quad.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index c6c05e6f48994..a599bad02b4d3 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -1376,10 +1376,11 @@ static int tegra_qspi_transfer_one_message(struct spi_controller *host, static irqreturn_t handle_cpu_based_xfer(struct tegra_qspi *tqspi) { - struct spi_transfer *t = tqspi->curr_xfer; + struct spi_transfer *t; unsigned long flags; spin_lock_irqsave(&tqspi->lock, flags); + t = tqspi->curr_xfer; if (tqspi->tx_status || tqspi->rx_status) { tegra_qspi_handle_error(tqspi); @@ -1410,7 +1411,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_qspi *tqspi) static irqreturn_t handle_dma_based_xfer(struct tegra_qspi *tqspi) { - struct spi_transfer *t = tqspi->curr_xfer; + struct spi_transfer *t; unsigned int total_fifo_words; unsigned long flags; long wait_status; @@ -1449,6 +1450,7 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_qspi *tqspi) } spin_lock_irqsave(&tqspi->lock, flags); + t = tqspi->curr_xfer; if (num_errors) { tegra_qspi_dma_unmap_xfer(tqspi, t); -- 2.51.0