wuxu.wu
b56f2a4a43
spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls
[ Upstream commit 19b61392c5 ]
dw_spi_irq() and dw_spi_transfer_one concurrent calls.
I find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,
dw->len==4, and dw->tx_end==1.
When tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one
may concurrent visit dw_spi, so I think dw_spi structure lack of protection.
Otherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,
store dw rx/tx instructions and other cores handle irq load dw rx/tx
instructions may out of order.
[ 1025.321302] Call trace:
...
[ 1025.321319] __crash_kexec+0x98/0x148
[ 1025.321323] panic+0x17c/0x314
[ 1025.321329] die+0x29c/0x2e8
[ 1025.321334] die_kernel_fault+0x68/0x78
[ 1025.321337] __do_kernel_fault+0x90/0xb0
[ 1025.321346] do_page_fault+0x88/0x500
[ 1025.321347] do_translation_fault+0xa8/0xb8
[ 1025.321349] do_mem_abort+0x68/0x118
[ 1025.321351] el1_da+0x20/0x8c
[ 1025.321362] dw_writer+0xc8/0xd0
[ 1025.321364] interrupt_transfer+0x60/0x110
[ 1025.321365] dw_spi_irq+0x48/0x70
...
Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
Link: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-05 14:18:06 +00:00
..
2020-01-17 19:45:52 +01:00
2019-08-09 17:53:37 +02:00
2020-01-27 14:46:28 +01:00
2019-07-10 09:54:31 +02:00
2020-01-27 14:46:12 +01:00
2020-01-12 12:11:53 +01:00
2020-02-05 14:18:06 +00:00
2020-02-05 14:18:06 +00:00
2019-11-24 08:23:28 +01:00
2020-01-27 14:46:35 +01:00
2019-12-31 12:37:22 +01:00
2019-11-24 08:22:43 +01:00
2019-12-01 09:14:14 +01:00
2019-11-20 18:00:22 +01:00
2019-12-31 12:37:37 +01:00
2019-11-24 08:23:33 +01:00
2019-05-31 06:47:35 -07:00
2019-12-01 09:13:21 +01:00
2019-12-31 12:37:45 +01:00
2019-12-31 12:37:42 +01:00
2020-01-27 14:46:28 +01:00
2020-01-27 14:46:14 +01:00
2019-05-31 06:47:35 -07:00
2019-12-31 12:36:47 +01:00