Commit 4ad01ae
net/sched: fix pedit partial COW leading to page cache corruption
jira VULN-188480
cve CVE-2026-46331
commit-author Rajat Gupta <rajat.gupta@oss.qualcomm.com>
commit 899ee91
upstream-diff |
rename include file from linux/unaligned.h to asm/unaligned.h
tcf_pedit_act() computes the COW range for skb_ensure_writable()
once before the key loop using tcfp_off_max_hint, but the hint does
not account for the runtime header offset added by typed keys. This
can leave part of the write region un-COW'd.
Fix by moving skb_ensure_writable() inside the per-key loop where
the actual write offset is known, and add overflow checking on the
offset arithmetic. For negative offsets (e.g. Ethernet header edits
at ingress), use skb_cow() to COW the headroom instead. Guard
offset_valid() against INT_MIN, where negation is undefined.
Fixes: 8b79647 ("net/sched: act_pedit: really ensure the skb is writable")
Reported-by: Yiming Qian <yimingqian591@gmail.com>
Reported-by: Keenan Dong <keenanat2000@gmail.com>
Reported-by: Han Guidong <2045gemini@gmail.com>
Reported-by: Zhang Cen <rollkingzzc@gmail.com>
Reviewed-by: Han Guidong <2045gemini@gmail.com>
Tested-by: Han Guidong <2045gemini@gmail.com>
Reviewed-by: Davide Caratti <dcaratti@redhat.com>
Tested-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Tested-by: Toke Høiland-Jørgensen <toke@redhat.com>
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Rajat Gupta <rajat.gupta@oss.qualcomm.com>
Link: https://patch.msgid.link/20260531123221.48732-1-jhs@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 899ee91)
Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>1 parent 5cf0a90 commit 4ad01ae
2 files changed
Lines changed: 41 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
235 | | - | |
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
| |||
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | 264 | | |
272 | 265 | | |
273 | 266 | | |
| |||
310 | 303 | | |
311 | 304 | | |
312 | 305 | | |
313 | | - | |
| 306 | + | |
314 | 307 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 308 | + | |
319 | 309 | | |
320 | 310 | | |
321 | | - | |
| 311 | + | |
322 | 312 | | |
323 | 313 | | |
324 | 314 | | |
| |||
384 | 374 | | |
385 | 375 | | |
386 | 376 | | |
387 | | - | |
388 | 377 | | |
389 | 378 | | |
390 | 379 | | |
391 | 380 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | 381 | | |
400 | 382 | | |
401 | 383 | | |
402 | 384 | | |
403 | 385 | | |
404 | 386 | | |
405 | 387 | | |
| 388 | + | |
406 | 389 | | |
407 | 390 | | |
408 | | - | |
409 | | - | |
| 391 | + | |
| 392 | + | |
410 | 393 | | |
411 | 394 | | |
412 | 395 | | |
| |||
424 | 407 | | |
425 | 408 | | |
426 | 409 | | |
| 410 | + | |
427 | 411 | | |
428 | | - | |
| 412 | + | |
| 413 | + | |
429 | 414 | | |
430 | 415 | | |
431 | 416 | | |
432 | 417 | | |
433 | | - | |
| 418 | + | |
434 | 419 | | |
435 | 420 | | |
436 | 421 | | |
| |||
442 | 427 | | |
443 | 428 | | |
444 | 429 | | |
445 | | - | |
446 | | - | |
| 430 | + | |
| 431 | + | |
447 | 432 | | |
448 | 433 | | |
449 | 434 | | |
450 | | - | |
451 | | - | |
452 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
453 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
454 | 461 | | |
455 | 462 | | |
456 | 463 | | |
457 | 464 | | |
458 | 465 | | |
459 | 466 | | |
460 | | - | |
| 467 | + | |
461 | 468 | | |
462 | 469 | | |
463 | 470 | | |
464 | 471 | | |
465 | 472 | | |
466 | 473 | | |
467 | | - | |
468 | | - | |
469 | | - | |
| 474 | + | |
470 | 475 | | |
471 | 476 | | |
472 | 477 | | |
| |||
0 commit comments