spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op
authorQuanyang Wang <quanyang.wang@windriver.com>
Fri, 16 Apr 2021 00:46:51 +0000 (08:46 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 16 Apr 2021 12:44:14 +0000 (13:44 +0100)
commita2c5bedb2d55dd27c642c7b9fb6886d7ad7bdb58
tree42ed662419cebfe3c4328d44b822ac7391532984
parent2530b3df4326023a171977ab46fdfeac0340f5b2
spi: spi-zynqmp-gqspi: fix use-after-free in zynqmp_qspi_exec_op

When handling op->addr, it is using the buffer "tmpbuf" which has been
freed. This will trigger a use-after-free KASAN warning. Let's use
temporary variables to store op->addr.val and op->cmd.opcode to fix
this issue.

Fixes: 1c26372e5aa9 ("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Link: https://lore.kernel.org/r/20210416004652.2975446-5-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-zynqmp-gqspi.c