lkml.org 
[lkml]   [2015]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.13.y-ckt 071/132] dm stats: fix divide by zero if 'number_of_areas' arg is zero
    Date
    3.13.11-ckt24 -stable review patch.  If anyone has any objections, please let me know.

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

    From: Mikulas Patocka <mpatocka@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 <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>
    Signed-off-by: Kamal Mostafa <kamal@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 28a9012..b3b0697 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


    \
     
     \ /
      Last update: 2015-07-23 04:21    [W:4.319 / U:0.160 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site