提交 710f81eb 编写于 作者: N NeilBrown 提交者: Xie XiuQi

dm: fix to_sector() for 32bit

mainline inclusion
from mainline-5.1-rc1
commit 0bdb50c531f7377a9da80d3ce2d61f389c84cb30
category: bugfix
bugzilla: 12155
CVE: NA

-------------------------------------------------
A dm-raid array with devices larger than 4GB won't assemble on
a 32 bit host since _check_data_dev_sectors() was added in 4.16.
This is because to_sector() treats its argument as an "unsigned long"
which is 32bits (4GB) on a 32bit host.  Using "unsigned long long"
is more correct.

Kernels as early as 4.2 can have other problems due to to_sector()
being used on the size of a device.

Fixes: 0cf45031 ("dm raid: add support for the MD RAID0 personality")
cc: stable@vger.kernel.org (v4.2+)
Reported-and-tested-by: NGuillaume Perréal <gperreal@free.fr>
Signed-off-by: NNeilBrown <neil@brown.name>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
(cherry picked from commit 0bdb50c531f7377a9da80d3ce2d61f389c84cb30)
Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 00921e9f
...@@ -601,7 +601,7 @@ do { \ ...@@ -601,7 +601,7 @@ do { \
*/ */
#define dm_target_offset(ti, sector) ((sector) - (ti)->begin) #define dm_target_offset(ti, sector) ((sector) - (ti)->begin)
static inline sector_t to_sector(unsigned long n) static inline sector_t to_sector(unsigned long long n)
{ {
return (n >> SECTOR_SHIFT); return (n >> SECTOR_SHIFT);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册