[dm-devel] [PATCH 1/4] dm-statistics: better argument validation
Mikulas Patocka
mpatocka at redhat.com
Tue Jun 9 21:21:13 UTC 2015
If the number_of_areas argument was zero, the kernel would crash on
div-by-zero. This patch fixes it.
Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
Cc: stable at vger.kernel.org # v3.12+
---
drivers/md/dm-stats.c | 2 ++
1 file changed, 2 insertions(+)
Index: linux-4.1-rc6/drivers/md/dm-stats.c
===================================================================
--- linux-4.1-rc6.orig/drivers/md/dm-stats.c 2015-06-05 15:39:58.000000000 +0200
+++ linux-4.1-rc6/drivers/md/dm-stats.c 2015-06-05 15:42:09.000000000 +0200
@@ -795,6 +795,8 @@ static int message_stats_create(struct m
return -EINVAL;
if (sscanf(argv[2], "/%u%c", &divisor, &dummy) == 1) {
+ if (!divisor)
+ return -EINVAL;
step = end - start;
if (do_div(step, divisor))
step++;
More information about the dm-devel
mailing list