diff options
author | Andy Shevchenko <[email protected]> | 2024-05-29 11:42:35 -0400 |
---|---|---|
committer | Mark Brown <[email protected]> | 2024-05-29 16:47:53 +0100 |
commit | 9dedabe95b49ec9b0d16ce8f0ed1f9a12dd4a040 (patch) | |
tree | 87a3e5a3b34adfef713819b3b9131bf1eadd2f2a /lib/test_fortify/write_overflow-memcpy.c | |
parent | 4a69c1264ff41bc5bf7c03101ada0454fbf08868 (diff) |
spi: Assign dummy scatterlist to unidirectional transfers
Commit 8cc3bad9d9d6 ("spi: Remove unneded check for orig_nents")
introduced a regression: unmapped data could now be passed to the DMA
APIs, resulting in null pointer dereferences. Commit 9f788ba457b4 ("spi:
Don't mark message DMA mapped when no transfer in it is") and commit
da560097c056 ("spi: Check if transfer is mapped before calling DMA sync
APIs") addressed the problem, but only partially. Unidirectional
transactions will still result in null pointer dereference. To prevent
that from happening, assign a dummy scatterlist when no data is mapped,
so that the DMA API can be called and not result in a null pointer
dereference.
Signed-off-by: Andy Shevchenko <[email protected]>
Reported-by: Neil Armstrong <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]
Reported-by: Nícolas F. R. A. Prado <[email protected]>
Closes: https://lore.kernel.org/all/d3679496-2e4e-4a7c-97ed-f193bd53af1d@notapiano
Closes: https://lore.kernel.org/all/4748499f-789c-45a8-b50a-2dd09f4bac8c@notapiano
Fixes: 8cc3bad9d9d6 ("spi: Remove unneded check for orig_nents")
Tested-by: Nícolas F. R. A. Prado <[email protected]>
[nfraprado: wrote the commit message]
Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
Link: https://msgid.link/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-memcpy.c')
0 files changed, 0 insertions, 0 deletions