lkml.org 
[lkml]   [2013]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 030/104] cfq: explicitly use 64bit divide operation for 64bit arguments
    Date
    3.8.13.11 -stable review patch.  If anyone has any objections, please let me know.

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

    From: Anatol Pomozov <anatol.pomozov@gmail.com>

    commit f3cff25f05f2ac29b2ee355e611b0657482f6f1d upstream.

    'samples' is 64bit operant, but do_div() second parameter is 32.
    do_div silently truncates high 32 bits and calculated result
    is invalid.

    In case if low 32bit of 'samples' are zeros then do_div() produces
    kernel crash.

    Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
    Acked-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Kamal Mostafa <kamal@canonical.com>
    ---
    block/cfq-iosched.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
    index e62e920..1a872282 100644
    --- a/block/cfq-iosched.c
    +++ b/block/cfq-iosched.c
    @@ -1484,7 +1484,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,

    if (samples) {
    v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
    - do_div(v, samples);
    + v = div64_u64(v, samples);
    }
    __blkg_prfill_u64(sf, pd, v);
    return 0;
    --
    1.8.1.2


    \
     
     \ /
      Last update: 2013-10-10 18:41    [W:4.076 / U:0.060 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site