[ 3.5.y.z extended stable ] Patch "cfq: explicitly use 64bit divide operation for 64bit" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Wed Oct 2 15:03:42 UTC 2013


This is a note to let you know that I have just added a patch titled

    cfq: explicitly use 64bit divide operation for 64bit

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 99ee1687508009f43257c3251e50f74f5c13e2c2 Mon Sep 17 00:00:00 2001
From: Anatol Pomozov <anatol.pomozov at gmail.com>
Date: Sun, 22 Sep 2013 12:43:47 -0600
Subject: [PATCH] cfq: explicitly use 64bit divide operation for 64bit
 arguments

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 at gmail.com>
Acked-by: Tejun Heo <tj at kernel.org>
Signed-off-by: Jens Axboe <axboe at kernel.dk>
Cc: Jonghwan Choi <jhbird.choi at gmail.com>
Signed-off-by: Luis Henriques <luis.henriques at 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 fb52df9..4d27120 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.3.2





More information about the kernel-team mailing list