Commit 2fe2434
scsi: pm8001: Fix phys_to_virt() usage on dma_addr_t
The driver supports a "direct" mode of operation, where the SMP req frame
is directly copied into the command payload (and vice-versa for the SMP
resp).
To get at the SMP req frame data in the scatterlist the driver uses
phys_to_virt() on the DMA mapped memory dma_addr_t . This is broken, and
subsequently crashes as follows when an IOMMU is enabled:
Unable to handle kernel paging request at virtual address
ffff0000fcebfb00
...
pc : pm80xx_chip_smp_req+0x2d0/0x3d0
lr : pm80xx_chip_smp_req+0xac/0x3d0
pm80xx_chip_smp_req+0x2d0/0x3d0
pm8001_task_exec.constprop.0+0x368/0x520
pm8001_queue_command+0x1c/0x30
smp_execute_task_sg+0xdc/0x204
sas_discover_expander.part.0+0xac/0x6cc
sas_discover_root_expander+0x8c/0x150
sas_discover_domain+0x3ac/0x6a0
process_one_work+0x1d0/0x354
worker_thread+0x13c/0x470
kthread+0x17c/0x190
ret_from_fork+0x10/0x20
Code: 371806e1 910006d6 6b16033f 54000249 (38766b05)
---[ end trace b91d59aaee98ea2d ]---
note: kworker/u192:0[7] exited with preempt_count 1
Instead use kmap_atomic().
--
Difference to v1:
- use kmap_atomic() in both locations
Difference to v2:
- add whitespace around arithmetic (Damien)
Link: https://lore.kernel.org/r/1639390248-213603-1-git-send-email-john.garry@huawei.com
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>1 parent 69002c8 commit 2fe2434
1 file changed
Lines changed: 21 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3053 | 3053 | | |
3054 | 3054 | | |
3055 | 3055 | | |
3056 | | - | |
3057 | 3056 | | |
3058 | 3057 | | |
3059 | 3058 | | |
| |||
3080 | 3079 | | |
3081 | 3080 | | |
3082 | 3081 | | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
3083 | 3086 | | |
3084 | 3087 | | |
3085 | 3088 | | |
3086 | | - | |
3087 | | - | |
3088 | | - | |
| 3089 | + | |
| 3090 | + | |
3089 | 3091 | | |
3090 | | - | |
| 3092 | + | |
3091 | 3093 | | |
3092 | 3094 | | |
3093 | | - | |
| 3095 | + | |
3094 | 3096 | | |
3095 | 3097 | | |
| 3098 | + | |
3096 | 3099 | | |
3097 | 3100 | | |
3098 | 3101 | | |
| |||
4236 | 4239 | | |
4237 | 4240 | | |
4238 | 4241 | | |
4239 | | - | |
| 4242 | + | |
4240 | 4243 | | |
4241 | 4244 | | |
4242 | 4245 | | |
4243 | 4246 | | |
4244 | | - | |
4245 | | - | |
4246 | 4247 | | |
| 4248 | + | |
| 4249 | + | |
4247 | 4250 | | |
4248 | 4251 | | |
4249 | 4252 | | |
| |||
4280 | 4283 | | |
4281 | 4284 | | |
4282 | 4285 | | |
4283 | | - | |
4284 | | - | |
| 4286 | + | |
| 4287 | + | |
| 4288 | + | |
4285 | 4289 | | |
4286 | 4290 | | |
4287 | 4291 | | |
4288 | 4292 | | |
4289 | 4293 | | |
4290 | 4294 | | |
4291 | 4295 | | |
4292 | | - | |
| 4296 | + | |
4293 | 4297 | | |
4294 | 4298 | | |
4295 | 4299 | | |
| |||
4320 | 4324 | | |
4321 | 4325 | | |
4322 | 4326 | | |
4323 | | - | |
| 4327 | + | |
4324 | 4328 | | |
4325 | 4329 | | |
4326 | 4330 | | |
4327 | | - | |
| 4331 | + | |
4328 | 4332 | | |
4329 | | - | |
| 4333 | + | |
4330 | 4334 | | |
4331 | 4335 | | |
4332 | 4336 | | |
4333 | | - | |
| 4337 | + | |
4334 | 4338 | | |
4335 | 4339 | | |
4336 | | - | |
| 4340 | + | |
4337 | 4341 | | |
4338 | 4342 | | |
4339 | 4343 | | |
| |||
0 commit comments