batman-adv: tp_meter: avoid divide-by-zero for dec_cwnd
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 33a3bb4a3345bb511f9c69c913da95d4693e2a4e · < 7d2a44bc6bbe39aed03c68864aa0e54e04a50278| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
batman-adv: tp_meter: avoid divide-by-zero for dec_cwnd
The cwnd is always MSS <= cwnd <= 0x20000000. But the calculation in batadv_tp_update_cwnd() assumes unsigned 32 bit arithmetics.
((mss * 8) ** 2) / (cwnd * 8)
In case cwnd is actually 0x20000000, it will be shifted by 3 bit to the left end up at 0x100000000 or U32_MAX + 1. It will therefore wrap around and be 0 - resulting in:
((mss * 8) ** 2) / 0
This is of course invalid and cannot be calculated. The calculation should must be simplified to avoid this overflow:
(mss ** 2) * 8 / cwnd
From the CVE record · Linux
The batman-adv tp_meter congestion-window calculation can overflow its divisor to zero when cwnd reaches 0x20000000, causing a divide-by-zero. The input does not establish whether an attacker can trigger this condition, or specify network access, authentication, or user-interaction requirements.
Engineers running Linux kernels with batman-adv should check their versions; affected versions are not specified.