In the Linux kernel, the following vulnerability has been resolved:
virtio: packed: fix unmap leak for indirect desc table
When usedmaapi and premapped are true, then the do_unmap is false.
Because the dounmap is false, vringunmapextrapacked is not called by detachbufpacked.
if (unlikely(vq->dounmap)) { curr = id; for (i = 0; i < state->num; i++) { vringunmapextrapacked(vq, &vq->packed.descextra[curr]); curr = vq->packed.descextra[curr].next; } }
So the indirect desc table is not unmapped. This causes the unmap leak.
So here, we check vq->usedmaapi instead. Synchronously, dma info is updated based on usedmaapi judgment
This bug does not occur, because no driver use the premapped with indirect.