Commit 9dedabe
spi: Assign dummy scatterlist to unidirectional transfers
Commit 8cc3bad ("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 9f788ba ("spi:
Don't mark message DMA mapped when no transfer in it is") and commit
da56009 ("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: 8cc3bad ("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]>1 parent 4a69c12 commit 9dedabe
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1220 | 1220 | | |
1221 | 1221 | | |
1222 | 1222 | | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
1223 | 1228 | | |
1224 | 1229 | | |
1225 | 1230 | | |
| |||
1258 | 1263 | | |
1259 | 1264 | | |
1260 | 1265 | | |
| 1266 | + | |
| 1267 | + | |
1261 | 1268 | | |
1262 | 1269 | | |
1263 | 1270 | | |
| |||
1271 | 1278 | | |
1272 | 1279 | | |
1273 | 1280 | | |
| 1281 | + | |
| 1282 | + | |
1274 | 1283 | | |
1275 | 1284 | | |
1276 | 1285 | | |
| |||
0 commit comments