mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 11:54:14 -04:00
dm: restrict dm device size to 2^63-512 bytes
[ Upstream commit 45fc728515c14f53f6205789de5bfd72a95af3b8 ] The devices with size >= 2^63 bytes can't be used reliably by userspace because the type off_t is a signed 64-bit integer. Therefore, we limit the maximum size of a device mapper device to 2^63-512 bytes. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ac7d620cad
commit
8a63c8d9c6
1 changed files with 4 additions and 0 deletions
|
|
@ -742,6 +742,10 @@ int dm_table_add_target(struct dm_table *t, const char *type,
|
|||
DMERR("%s: zero-length target", dm_device_name(t->md));
|
||||
return -EINVAL;
|
||||
}
|
||||
if (start + len < start || start + len > LLONG_MAX >> SECTOR_SHIFT) {
|
||||
DMERR("%s: too large device", dm_device_name(t->md));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
tgt->type = dm_get_target_type(type);
|
||||
if (!tgt->type) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue