Commit ce94d6a1 authored by Xie Yongji's avatar Xie Yongji Committed by Yang Yingliang
Browse files

virtio-blk: Add validation for block size in config space



mainline inclusion
from mainline-v5.14-rc7
commit 82e89ea0
category: bufgix
bugzilla: NA
CVE: NA

--------------------------------

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: default avatarXie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20210809101609.148-1-xieyongji@bytedance.com


Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>

Conflict: drivers/block/virtio_blk.c
a. commit d1e9aa9c ("virtio-blk: support per-device queue depth")
is not backported, 'unsigned int queue_depth' do not exist.
b. commit e982c4d0 ("virtio-blk: modernize sysfs attribute creation")
is not backported, 'virtblk_attr_groups' do not exist.
c. commit f525464a ("block: add blk_alloc_disk and blk_cleanup_disk APIs")
and commit 89a5f065 ("virtio-blk: use blk_mq_alloc_disk") is not
backported, 'blk_cleanup_disk' is needed to repleace with 'blk_cleanup_queue',
'out_free_vq' is needed to replace with 'out_put_disk'.
Signed-off-by: default avatarLi Jinlin <lijinlin3@huawei.com>
Reviewed-by: default avatarlouhongxiang <louhongxiang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent ed9f7876
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment