]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
block: fix an integer overflow in logical block size
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 15 Jan 2020 13:35:25 +0000 (08:35 -0500)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commitc35a4a858d0616e7817026d88f377c7201ad449a
tree1a4ffcd3da1cb83e0e8f148e582c1c709b4225e6
parent31e3c075719a3afe5ffd2b9b8e1f18e07255bd96
block: fix an integer overflow in logical block size

BugLink: https://bugs.launchpad.net/bugs/1862259
commit ad6bf88a6c19a39fb3b0045d78ea880325dfcf15 upstream.

Logical block size has type unsigned short. That means that it can be at
most 32768. However, there are architectures that can run with 64k pages
(for example arm64) and on these architectures, it may be possible to
create block devices with 64k block size.

For exmaple (run this on an architecture with 64k pages):

Mount will fail with this error because it tries to read the superblock using 2-sector
access:
  device-mapper: writecache: I/O is not aligned, sector 2, size 1024, block size 65536
  EXT4-fs (dm-0): unable to read superblock

This patch changes the logical block size from unsigned short to unsigned
int to avoid the overflow.

Cc: stable@vger.kernel.org
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
block/blk-settings.c
drivers/md/dm-snap-persistent.c
drivers/md/raid0.c
include/linux/blkdev.h