[PATCH] virtio_blk: set log2blksz correctly

Bin Meng bmeng.cn at gmail.com
Wed Aug 19 11:38:47 CEST 2020

On Wed, Aug 19, 2020 at 5:08 PM AKASHI Takahiro
<takahiro.akashi at linaro.org> wrote:
> 'log2blksz' in blk_desc structure must always be initialized, otherwise
> it will cause a lot of weird failures in file operations.
> For example, fs_set_blk_dev[_with_part]() examines a block device against
> every file system with its probe function. In particular, ext4 file
> system's ext4_probe() will calls fs_devread() to fetch a super block.
> If log2blksz is 0, the actual 'read' size, i.e. block_len >> log2blksz, is
> much bigger than a buffer's size, and it can end up with memory corruption.
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
> Fixes: f4802209e59d ("virtio: Add block driver support")
> ---
>  drivers/virtio/virtio_blk.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

More information about the U-Boot mailing list