Commit cb3bdd8
net/sched: fix pedit partial COW leading to page cache corruption
jira VULN-188478
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 ff3171f commit cb3bdd8
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 | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
239 | | - | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | 268 | | |
276 | 269 | | |
277 | 270 | | |
| |||
314 | 307 | | |
315 | 308 | | |
316 | 309 | | |
317 | | - | |
| 310 | + | |
318 | 311 | | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
| 312 | + | |
323 | 313 | | |
324 | 314 | | |
325 | | - | |
| 315 | + | |
326 | 316 | | |
327 | 317 | | |
328 | 318 | | |
| |||
388 | 378 | | |
389 | 379 | | |
390 | 380 | | |
391 | | - | |
392 | 381 | | |
393 | 382 | | |
394 | 383 | | |
395 | 384 | | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | 385 | | |
404 | 386 | | |
405 | 387 | | |
406 | 388 | | |
407 | 389 | | |
408 | 390 | | |
409 | 391 | | |
| 392 | + | |
410 | 393 | | |
411 | 394 | | |
412 | | - | |
413 | | - | |
| 395 | + | |
| 396 | + | |
414 | 397 | | |
415 | 398 | | |
416 | 399 | | |
| |||
428 | 411 | | |
429 | 412 | | |
430 | 413 | | |
| 414 | + | |
431 | 415 | | |
432 | | - | |
| 416 | + | |
| 417 | + | |
433 | 418 | | |
434 | 419 | | |
435 | 420 | | |
436 | 421 | | |
437 | | - | |
| 422 | + | |
438 | 423 | | |
439 | 424 | | |
440 | 425 | | |
| |||
446 | 431 | | |
447 | 432 | | |
448 | 433 | | |
449 | | - | |
450 | | - | |
| 434 | + | |
| 435 | + | |
451 | 436 | | |
452 | 437 | | |
453 | 438 | | |
454 | | - | |
455 | | - | |
456 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
457 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
458 | 465 | | |
459 | 466 | | |
460 | 467 | | |
461 | 468 | | |
462 | 469 | | |
463 | 470 | | |
464 | | - | |
| 471 | + | |
465 | 472 | | |
466 | 473 | | |
467 | 474 | | |
468 | 475 | | |
469 | 476 | | |
470 | 477 | | |
471 | | - | |
472 | | - | |
473 | | - | |
| 478 | + | |
474 | 479 | | |
475 | 480 | | |
476 | 481 | | |
| |||
0 commit comments