Commit 5a52215
vhost-vdpa: free iommu domain after last use during cleanup
Currently vhost_vdpa_cleanup() unmaps the DMA mappings by calling
`iommu_unmap(v->domain, map->start, map->size);`
from vhost_vdpa_general_unmap() when the parent vDPA driver doesn't
provide DMA config operations.
However, the IOMMU domain referred to by `v->domain` is freed in
vhost_vdpa_free_domain() before vhost_vdpa_cleanup() in
vhost_vdpa_release() which results in NULL pointer de-reference.
Accordingly, moving the call to vhost_vdpa_free_domain() in
vhost_vdpa_cleanup() would makes sense. This will also help
detaching the dma device in error handling of vhost_vdpa_alloc_domain().
This issue was observed on terminating QEMU with SIGQUIT.
Fixes: 037d430 ("vhost-vdpa: call vhost_vdpa_cleanup during the release")
Signed-off-by: Gautam Dawar <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Jason Wang <[email protected]>
Reviewed-by: Stefano Garzarella <[email protected]>1 parent 09e65ee commit 5a52215
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
| 1172 | + | |
1172 | 1173 | | |
1173 | 1174 | | |
1174 | 1175 | | |
| |||
1213 | 1214 | | |
1214 | 1215 | | |
1215 | 1216 | | |
| 1217 | + | |
1216 | 1218 | | |
1217 | 1219 | | |
1218 | 1220 | | |
| |||
1285 | 1287 | | |
1286 | 1288 | | |
1287 | 1289 | | |
1288 | | - | |
1289 | 1290 | | |
1290 | 1291 | | |
1291 | 1292 | | |
| |||
0 commit comments