Please sign in to comment.
lib/flex_proportions.c: fix corruption of denominator in flexible pro…
…portions When racing with CPU hotplug, percpu_counter_sum() can return negative values for the number of observed events. This confuses fprop_new_period(), which uses unsigned type and as a result number of events is set to big *positive* number. From that moment on, things go pear shaped and can result e.g. in division by zero as denominator is later truncated to 32-bits. This bug causes a divide-by-zero oops in bdi_dirty_limit() in Borislav's 3.6.0-rc6 based kernel. Fix the issue by using a signed type in fprop_new_period(). That makes us bail out from the function without doing anything (mistakenly) thinking there are no events to age. That makes aging somewhat inaccurate but getting accurate data would be rather hard. Signed-off-by: Jan Kara <firstname.lastname@example.org> Reported-by: Borislav Petkov <email@example.com> Reported-by: Srivatsa S. Bhat <firstname.lastname@example.org> Cc: Wu Fengguang <email@example.com> Cc: Peter Zijlstra <firstname.lastname@example.org> Cc: <email@example.com> Signed-off-by: Andrew Morton <firstname.lastname@example.org> Signed-off-by: Linus Torvalds <email@example.com>
- Loading branch information...