All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
To: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: Den Lunev <den@virtuozzo.com>, devel@openvz.org
Subject: [Devel] [PATCH hci-8.2 v2 1/2] dm/push_backup: reject a cluster size of 0
Date: Wed, 25 Nov 2026 12:12:05 +0000	[thread overview]
Message-ID: <20261125-push-backup-fixes-v2-1-195a2bcd82f7@virtuozzo.com> (raw)
In-Reply-To: <20261125-push-backup-fixes-v2-0-195a2bcd82f7@virtuozzo.com>

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@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

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-25 12:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 12:12 [Devel] [PATCH hci-8.2 v2 0/2] dm/push_backup: fix two old bugs Vasileios Almpanis
2026-11-25 12:12 ` Vasileios Almpanis [this message]
2026-12-01  0:14   ` [Devel] [PATCH hci-8.2 v2 1/2] dm/push_backup: reject a cluster size of 0 no-reply
2026-11-25 12:12 ` [Devel] [PATCH hci-8.2 v2 2/2] dm/push_backup: free the bitmaps of an expired session on restart Vasileios Almpanis
2026-12-01  0:15   ` no-reply
2026-11-25 12:16 ` [Devel] [PATCH hci-8.2 v2 0/2] dm/push_backup: fix two old bugs Andrey Zhadchenko
2026-11-30 15:06 ` Konstantin Khorenko
2026-11-30 15:06 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125-push-backup-fixes-v2-1-195a2bcd82f7@virtuozzo.com \
    --to=vasileios.almpanis@virtuozzo.com \
    --cc=den@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.