title: mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again
description: In the Linux kernel, the following vulnerability has been resolved:
mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again
(struct dirty_throttle_control *)->thresh is an unsigned long, but is
passed as the u32 divisor argument to div_u64().  On architectures where
unsigned long is 64 bytes, the argument will be implicitly truncated.
Use div64_u64() instead of div_u64() so that the value used in the "is
this a safe division" check is the same as the divisor.
Also, remove redundant cast of the numerator to u64, as that should happen
implicitly.
This would be difficult to exploit in memcg domain, given the ratio-based
arithmetic domain_drity_limits() uses, but is much easier in global
writeback domain with a BDI_CAP_STRICTLIMIT-backing device, using e.g.
vm.dirty_bytes=(1<<32)*PAGE_SIZE so that dtc->thresh == (1<<32)
affected:
{
product: Linux
vendor: Linux
defaultStatus: unaffected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: f6789593d5ce, lessThan: c593d26fb5d5, status: affected, versionType: git
version: f6789593d5ce, lessThan: 1f12e4b3284d, status: affected, versionType: git
version: f6789593d5ce, lessThan: 81e7d2530d45, status: affected, versionType: git
version: f6789593d5ce, lessThan: 5099871b3703, status: affected, versionType: git
version: f6789593d5ce, lessThan: 16b1025eaa8f, status: affected, versionType: git
version: f6789593d5ce, lessThan: ec18ec230301, status: affected, versionType: git
version: f6789593d5ce, lessThan: 65977bed167a, status: affected, versionType: git
version: f6789593d5ce, lessThan: 9319b647902c, status: affected, versionType: git
}
{
product: Linux
vendor: Linux
defaultStatus: affected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: 3.16, status: affected
version: 0, lessThan: 3.16, status: unaffected, versionType: custom
version: 4.19.307, lessThanOrEqual: 4.19.*, status: unaffected, versionType: custom
version: 5.4.269, lessThanOrEqual: 5.4.*, status: unaffected, versionType: custom
version: 5.10.210, lessThanOrEqual: 5.10.*, status: unaffected, versionType: custom
version: 5.15.149, lessThanOrEqual: 5.15.*, status: unaffected, versionType: custom
version: 6.1.79, lessThanOrEqual: 6.1.*, status: unaffected, versionType: custom
version: 6.6.18, lessThanOrEqual: 6.6.*, status: unaffected, versionType: custom
version: 6.7.6, lessThanOrEqual: 6.7.*, status: unaffected, versionType: custom
version: 6.8, lessThanOrEqual: *, status: unaffected, versionType: original_commit_for_fix
}
