From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379734; b=i/3b5UubcanNtjHO1FS7w3nnabDJA+6pZsYBEtOQIN6pJqtnisIIgwVntB+r/p5ONCO8 EAFFB4S/CSD0gOvuZHb33BHtpUcbPe4N3RrmtXKeiOMyT3QM+PHj1uziLV+o6qz4ymGh+ 98lNWOR7wkfMDjGvKVG8Qv7ruB+l4BmwcqIFiujMlKo+CEgiHDYWRgV56aGAhWjQcAj4A K6UESYVXWafs6SiP7xqXaC8uSqpK1mjcJEOaZIu0CLVsKcPRnx5rqX2KddN+patN0daj5 i5S4NbN6PXoeiWTqRZbGeQmmVFLp4S2e/2MW1TwgmXcNhtLrvSdRMnwb9qAOizsqfww== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379734; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=jwugAXOMMszabtuzgH4Gx8lz9SZKS1QNyKy6Pu2gdME=; b=QBT/T8eeCtGYPOQdqha23y5Qx/w1YfeGXsKvV6p1M80xlrx9wnsD6EedgYM6QY3SlO2v dAUSUSna9FnIT3WqvGiZZXLBbUs1dbP7qmAHLcM0LpbCQEhnnyJ3zKLJhXKJKLEprdgtR uqGeK0YWC7tCTGKRU3XkB/R+I52kJSfn10T5P88wkuwAMdDYE4YL2Va0jZmwkNNUgK52n Ma1Eujowz72a7F1iN1VU83X/otjGZ6rLO5afvFwOwWpS8ZAQMTL3xXIqa+v9psek+NnIu chpJ+U/Vj6M+O4Iw6jaO0YdbbDHTQ9FuMSeV6RdZPctCnMLqQVXHp3C9ydeAtgzLbxQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=aM4yZNfm; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 260F1606A322; Fri, 4 Dec 2026 10:22:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=aM4yZNfm Received: by smtp.kernel.org (Postfix) with ESMTPSA id 920571F000C2; Fri, 4 Dec 2026 10:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379734; bh=jwugAXOMMszabtuzgH4Gx8lz9SZKS1QNyKy6Pu2gdME=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aM4yZNfmT6pKt7JQT7vj1L85twEwGtQoM34nMELgffyLHEYX7YWC31gcIuYaKKoqu T3bWUzfA6lkq/toBGqtJthV/lpmH0wCHpsMycvEi3ITNsDwvlSh9q2pEKv+9swWQZf ZdEmi766oaVvjjdEjDdY4r3+P7UjAEPvY4pw65NI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hongjian Dai , Mark Brown , Sasha Levin Subject: [PATCH 6.6 0064/1167] spi: pic32-sqi: fail transfer when the BD ring is exhausted Date: Fri, 4 Dec 2026 18:51:31 +0900 Message-ID: <20261204100703.748869816@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hongjian Dai [ Upstream commit 2066970324a1439e5a2e08c4599098367f8f82cc ] pic32_sqi_one_transfer() silently stopped programming buffer descriptors when ring_desc_get() returned NULL and still returned success. The caller then marked the last programmed descriptor as the end of the list and started the DMA engine, so the hardware transferred only a prefix of the requested data while the message completed with status 0. The ring holds PESQI_BD_COUNT (256) descriptors of at most PESQI_BD_BUF_LEN_MAX (256) bytes each, so messages larger than 64 KiB (or with enough SG entries) can exhaust it. Since the driver sets no max_message_size/max_transfer_size, the SPI core does not prevent this. Return -ENOMEM instead, and set msg->status so the failure reaches the caller rather than being silently truncated. Fixes: 3270ac230f66 ("spi: pic32-sqi: add SPI driver for PIC32 SQI controller.") Signed-off-by: Hongjian Dai Link: https://patch.msgid.link/F5276982A630220B+20261017075545.95854-1-daihongjian@kylinsec.com.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-pic32-sqi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-pic32-sqi.c b/drivers/spi/spi-pic32-sqi.c index 883354d0ff526..0044d38b915e2 100644 --- a/drivers/spi/spi-pic32-sqi.c +++ b/drivers/spi/spi-pic32-sqi.c @@ -297,7 +297,7 @@ static int pic32_sqi_one_transfer(struct pic32_sqi *sqi, /* get ring descriptor */ rdesc = ring_desc_get(sqi); if (!rdesc) - break; + return -ENOMEM; bd = rdesc->bd; @@ -387,6 +387,7 @@ static int pic32_sqi_one_message(struct spi_controller *host, ret = pic32_sqi_one_transfer(sqi, msg, xfer); if (ret) { dev_err(&spi->dev, "xfer %p err\n", xfer); + msg->status = ret; goto xfer_out; } } -- 2.53.0