提交 dd4c1b7d 编写于 作者: M Mikulas Patocka 提交者: Mike Snitzer

dm stats: fix divide by zero if 'number_of_areas' arg is zero

If the number_of_areas argument was zero the kernel would crash on
div-by-zero.  Add better input validation.
Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # v3.12+
上级 bccab6a0
......@@ -792,6 +792,8 @@ static int message_stats_create(struct mapped_device *md,
return -EINVAL;
if (sscanf(argv[2], "/%u%c", &divisor, &dummy) == 1) {
if (!divisor)
return -EINVAL;
step = end - start;
if (do_div(step, divisor))
step++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册