]> git.itanic.dy.fi Git - linux-stable/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:17:38 +0000 (18:17 -0400)
commit1784053cf10a14c4ebd8a890bad5cfe1bee51713
treef778d24efda8547036822cec5a8d14c62a71b432
parente77a6b53a3a547b6dedfc40c37cee4f310701090
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