3.19.8-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

------------------

From: Mikulas Patocka <mpato...@redhat.com>

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 <mpato...@redhat.com>
Signed-off-by: Mike Snitzer <snit...@redhat.com>
Signed-off-by: Kamal Mostafa <ka...@canonical.com>
---
 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to