]> git.baikalelectronics.ru Git - kernel.git/commit
virtio-blk: Add validation for block size in config space
authorXie Yongji <xieyongji@bytedance.com>
Mon, 9 Aug 2021 10:16:09 +0000 (18:16 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 11 Aug 2021 10:44:24 +0000 (06:44 -0400)
commit52b5e24890b4c6eb6edf887eb5ffb5b78437ee23
tree42f68656fd5af5f72814197e1885885a4a1e5583
parent45942355fc8aecb4ef5f8ce896d575b69ca12060
virtio-blk: Add validation for block size in config space

An untrusted device might presents an invalid block size
in configuration space. This tries to add validation for it
in the validate callback and clear the VIRTIO_BLK_F_BLK_SIZE
feature bit if the value is out of the supported range.

And we also double check the value in virtblk_probe() in
case that it's changed after the validation.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20210809101609.148-1-xieyongji@bytedance.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/block/virtio_blk.c