ptp: netc: fix period truncation and potential divide-by-zero in PEROUT
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.18.527.2.67.3In the Linux kernel, the following vulnerability has been resolved:
ptp: netc: fix period truncation and potential divide-by-zero in PEROUT
The max_period bound in net_timer_enable_perout() was computed as:
max_period = (u64)NETC_TMR_DEFAULT_FIPER + integral_period;
which exceeds U32_MAX when integral_period > 0 (e.g. 0x100000002 for the default 333333333 Hz clock). A period_ns that passes this check but exceeds U32_MAX is then silently truncated when stored into the u32 struct netc_pp::period field.
A truncated value of zero can reach netc_timer_set_perout_alarm(), where the local u32 period variable would also be 0, causing a divide-by-zero in roundup_u64(delta, period) whenever the stime < min_time branch is taken (which always happens for a start time of {0, 0}).
Additionally, netc_timer_enable_periodic_pulse() and netc_timer_enable_fiper() both compute:
fiper = pp->period - integral_period;
From the CVE record · Linux
The Linux kernel’s NETC PTP PEROUT code can truncate an oversized period to zero. Someone able to configure PEROUT with such a period and a start time of {0, 0} can trigger a divide-by-zero; a zero period can also mis-program the FIPER hardware register. The input does not specify network access or authentication requirements.
Engineers running the Linux kernel with NETC PTP PEROUT support should check their kernel version against the vendor advisory; affected versions are not specified here.