[Devel] [PATCH RHEL8 COMMIT] ploop: Add check device is not wider than BAT
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 13 15:41:26 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.6
------>
commit fabccc2df00df07dfb1b64c0f9a76c164e18e133
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Fri Aug 13 15:41:26 2021 +0300
ploop: Add check device is not wider than BAT
https://jira.sw.ru/browse/PSBM-132803
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-bat.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/md/dm-ploop-bat.c b/drivers/md/dm-ploop-bat.c
index f2a2d35818b8..44cbce6f6b40 100644
--- a/drivers/md/dm-ploop-bat.c
+++ b/drivers/md/dm-ploop-bat.c
@@ -269,6 +269,7 @@ int ploop_setup_metadata(struct ploop *ploop, struct page *page)
{
struct ploop_pvd_header *m_hdr = NULL;
u32 bat_clusters, offset_clusters;
+ struct dm_target *ti = ploop->ti;
unsigned long size;
int ret;
@@ -302,6 +303,11 @@ int ploop_setup_metadata(struct ploop *ploop, struct page *page)
pr_err("ploop: custom FirstBlockOffset\n");
goto out;
}
+ ret = -EBADSLT;
+ if (le64_to_cpu(m_hdr->m_SizeInSectors_v2) < ti->len) {
+ pr_err("ploop: Too short BAT\n");
+ goto out;
+ }
kunmap(page);
m_hdr = NULL;
More information about the Devel
mailing list