Commit ae8508b
net/sched: taprio: enforce minimum value for picos_per_byte
Syzbot reported a WARNING in taprio_get_start_time().
When link speed is 470,589 or greater, q->picos_per_byte becomes too
small, causing length_to_duration(q, ETH_ZLEN) to return zero.
This zero value leads to validation failures in fill_sched_entry() and
parse_taprio_schedule(), allowing arbitrary values to be assigned to
entry->interval and cycle_time. As a result, sched->cycle can become zero.
Since SPEED_800000 is the largest defined speed in
include/uapi/linux/ethtool.h, this issue can occur in realistic scenarios.
To ensure length_to_duration() returns a non-zero value for minimum-sized
Ethernet frames (ETH_ZLEN = 60), picos_per_byte must be at least 17
(60 * 17 > PSEC_PER_NSEC which is 1000).
This patch enforces a minimum value of 17 for picos_per_byte when the
calculated value would be lower, and adds a warning message to inform
users that scheduling accuracy may be affected at very high link speeds.
Fixes: fb66df2 ("net/sched: taprio: extend minimum interval restriction to entire cycle too")
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=398e1ee4ca2cac05fddb
Signed-off-by: Takamitsu Iwai <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent d46e51f commit ae8508b
1 file changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| |||
1284 | 1289 | | |
1285 | 1290 | | |
1286 | 1291 | | |
1287 | | - | |
| 1292 | + | |
| 1293 | + | |
1288 | 1294 | | |
1289 | 1295 | | |
1290 | 1296 | | |
| |||
1300 | 1306 | | |
1301 | 1307 | | |
1302 | 1308 | | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
1303 | 1318 | | |
1304 | 1319 | | |
1305 | 1320 | | |
| |||
1324 | 1339 | | |
1325 | 1340 | | |
1326 | 1341 | | |
1327 | | - | |
| 1342 | + | |
1328 | 1343 | | |
1329 | 1344 | | |
1330 | 1345 | | |
| |||
1844 | 1859 | | |
1845 | 1860 | | |
1846 | 1861 | | |
1847 | | - | |
| 1862 | + | |
1848 | 1863 | | |
1849 | 1864 | | |
1850 | 1865 | | |
| |||
0 commit comments