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>] [day] [month] [year] [list]
Message-Id: <20241210112712.483893-1-haibo.chen@nxp.com>
Date: Tue, 10 Dec 2024 19:27:12 +0800
From: haibo.chen@....com
To: broonie@...nel.org,
	bbrezillon@...nel.org,
	frieder.schrempf@...eet.de
Cc: linux-spi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	imx@...ts.linux.dev,
	han.xu@....com,
	chengminglin@...c.com.tw,
	stable@...r.kernel.org,
	haibo.chen@....com,
	jason.hui.liu@....com
Subject: [PATCH] spi: spi-mem: check the dummy buswidth only for rx mode

From: Haibo Chen <haibo.chen@....com>

Dummy usually used for rx, so combine the dummy buswidth check only
for rx mode.

Find issue after commit 98d1fb94ce75 ("mtd: spi-nor: core: replace
dummy buswidth from addr to data") on imx8mn-ddr4-evk board. On this
board, rx=4, tx=1, without the upper commit, chose SNOR_CMD_READ_1_1_4,
after this commit, chose SNOR_CMD_READ(1_1_1). This is because when
dummy buswidth = 4, spi_check_buswidth_req(mem, op->dummy.buswidth, true)
do not return the expected result.

Combine the cmd.buswidth and addr.buswidth check to tx is reasonable,
but for dummy buswidth, need to check the rx mode.

Fixes: c36ff266dc82 ("spi: Extend the core to ease integration of SPI memory controllers")
Cc: stable@...r.kernel.org
Signed-off-by: Haibo Chen <haibo.chen@....com>
---
 drivers/spi/spi-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index abc6792e738c..bc9f09a9e5a0 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -150,7 +150,7 @@ static bool spi_mem_check_buswidth(struct spi_mem *mem,
 		return false;
 
 	if (op->dummy.nbytes &&
-	    spi_check_buswidth_req(mem, op->dummy.buswidth, true))
+	    spi_check_buswidth_req(mem, op->dummy.buswidth, false))
 		return false;
 
 	if (op->data.dir != SPI_MEM_NO_DATA &&
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ