]> 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)
commitcf39d22440f2023c22bba087ccc686f643b1a302
tree42f68656fd5af5f72814197e1885885a4a1e5583
parent11ec8cb36cd1488ee007a37bbaf8ae45829760c1
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