virtio_ring: secure handling of mapping errors
authorJason Wang <jasowang@redhat.com>
Fri, 4 Jun 2021 05:53:47 +0000 (13:53 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 8 Jul 2021 11:49:01 +0000 (07:49 -0400)
commit44593865b7c5f55bf587f297c72d682c671eea2b
tree591ca6616d1dd5472fb3f6d1f8416fa1345e9eb5
parent5a22242160201b819be2fe67e15cc9338f3ee582
virtio_ring: secure handling of mapping errors

We should not depend on the DMA address, length and flag of descriptor
table since they could be wrote with arbitrary value by the device. So
this patch switches to use the stored one in desc_extra.

Note that the indirect descriptors are fine since they are read-only
streaming mappings.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20210604055350.58753-5-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_ring.c