]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: spi-mt65xx: Fix NULL pointer access in interrupt handler
authorFei Shao <fshao@chromium.org>
Thu, 21 Mar 2024 07:08:57 +0000 (15:08 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:22:43 +0000 (18:22 -0400)
commit2342b05ec5342a519e00524a507f7a6ea6791a38
tree75b1f064df7cc92e146360b8e1c8dea1a9fdc5ce
parent7bcc090c81116c66936a7415f2c6b1483a4bcfd9
spi: spi-mt65xx: Fix NULL pointer access in interrupt handler

[ Upstream commit a20ad45008a7c82f1184dc6dee280096009ece55 ]

The TX buffer in spi_transfer can be a NULL pointer, so the interrupt
handler may end up writing to the invalid memory and cause crashes.

Add a check to trans->tx_buf before using it.

Fixes: 1ce24864bff4 ("spi: mediatek: Only do dma for 4-byte aligned buffers")
Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://msgid.link/r/20240321070942.1587146-2-fshao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-mt65xx.c