[Devel] [PATCH hci-8.2 1/3] dm/push_backup: reject a cluster size of 0
Vasileios Almpanis
vasileios.almpanis at virtuozzo.com
Wed Nov 25 14:29:51 MSK 2026
pb_ctr() parses the cluster size with kstrtou32(), which accepts 0, and
then computes the number of clusters with DIV_ROUND_UP(ti->len, sectors).
So a table line with a cluster size of 0 divides by zero and oopses
inside the constructor. Even if the constructor survived, pb->clu_size
would be 0 and calc_bio_clusters() would divide by it on every write.
Only root can load a table, but a malformed table line must not oops
the kernel. Reject a cluster size of 0 with EINVAL.
https://virtuozzo.atlassian.net/browse/VSTOR-155791
Feature: dm-backup: push backup target driver
Fixes: 162123bc62c7 ("dm: Add push backup driver")
Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
drivers/md/dm-push-backup.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c
index 745ed28fd074..504713a9430e 100644
--- a/drivers/md/dm-push-backup.c
+++ b/drivers/md/dm-push-backup.c
@@ -890,6 +890,11 @@ static int pb_ctr(struct dm_target *ti, unsigned int argc, char **argv)
ti->error = "could not parse cluster size";
goto err;
}
+ if (!sectors) {
+ ret = -EINVAL;
+ ti->error = "cluster size must not be zero";
+ goto err;
+ }
pb->clu_size = to_bytes(sectors);
pb->nr_clus = DIV_ROUND_UP(ti->len, sectors);
--
2.43.0
More information about the Devel
mailing list