Commit d3684416 authored by Min Li's avatar Min Li Committed by Li Lingfeng
Browse files

block: add check that partition length needs to be aligned with block size

mainline inclusion
from mainline-v6.8-rc1
commit 6f64f866aa1ae6975c95d805ed51d7e9433a0016
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I93EC9
CVE: CVE-2023-52458

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f64f866aa1ae6975c95d805ed51d7e9433a0016



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

Before calling add partition or resize partition, there is no check
on whether the length is aligned with the logical block size.
If the logical block size of the disk is larger than 512 bytes,
then the partition size maybe not the multiple of the logical block size,
and when the last sector is read, bio_truncate() will adjust the bio size,
resulting in an IO error if the size of the read command is smaller than
the logical block size.If integrity data is supported, this will also
result in a null pointer dereference when calling bio_integrity_free.

Cc:  <stable@vger.kernel.org>
Signed-off-by: default avatarMin Li <min15.li@samsung.com>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230629142517.121241-1-min15.li@samsung.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>

Conflict:
  block/ioctl.c
  commit 1a721de8 ("block: don't add or resize partition on the disk
  with GENHD_FL_NO_PART") from mainline add check of GENHD_FL_NO_PART;
  commit 1ae011cf ("block: Fix the partition start may overflow in
  add_partition()") from hulk add check of start and length.
Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
parent a5194e63
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment