[Devel] [PATCH RH8] ploop: Add check device is not wider than BAT
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Aug 11 11:53:52 MSK 2021
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