On Mon, Oct 4, 2021 at 11:27 PM Michael S. Tsirkin <mst@xxxxxxxxxx> wrote: > > On Mon, Aug 09, 2021 at 06:16:09PM +0800, Xie Yongji wrote: > > 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@xxxxxxxxxxxxx> > > So I had to revert this due basically bugs in QEMU. > > My suggestion at this point is to try and update > blk_queue_logical_block_size to BUG_ON when the size > is out of a reasonable range. > > This has the advantage of fixing more hardware, not just virtio. > I wonder if it's better to just add a new patch to remove the virtblk_validate() part. And the check of block size in virtblk_probe() can be safely removed after the block layer is changed to validate the block size. Thanks, Yongji