Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756179AbbGPBry (ORCPT ); Wed, 15 Jul 2015 21:47:54 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55831 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754752AbbGPBLA (ORCPT ); Wed, 15 Jul 2015 21:11:00 -0400 From: Kamal Mostafa To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Mikulas Patocka , Mike Snitzer , Kamal Mostafa Subject: [PATCH 3.19.y-ckt 134/251] dm stats: fix divide by zero if 'number_of_areas' arg is zero Date: Wed, 15 Jul 2015 18:07:35 -0700 Message-Id: <1437008972-9140-135-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437008972-9140-1-git-send-email-kamal@canonical.com> References: <1437008972-9140-1-git-send-email-kamal@canonical.com> X-Extended-Stable: 3.19 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1201 Lines: 39 3.19.8-ckt4 -stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikulas Patocka commit dd4c1b7d0c95be1c9245118a3accc41a16f1db67 upstream. If the number_of_areas argument was zero the kernel would crash on div-by-zero. Add better input validation. Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Kamal Mostafa --- drivers/md/dm-stats.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c index f478a4c..419bdd4 100644 --- a/drivers/md/dm-stats.c +++ b/drivers/md/dm-stats.c @@ -795,6 +795,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++; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/