Commit 142b79a
af_key: Always verify length of provided sadb_key
commit 4b66af2 upstream.
Key extensions (struct sadb_key) include a user-specified number of key
bits. The kernel uses that number to determine how much key data to copy
out of the message in pfkey_msg2xfrm_state().
The length of the sadb_key message must be verified to be long enough,
even in the case of SADB_X_AALG_NULL. Furthermore, the sadb_key_len value
must be long enough to include both the key data and the struct sadb_key
itself.
Introduce a helper function verify_key_len(), and call it from
parse_exthdrs() where other exthdr types are similarly checked for
correctness.
Signed-off-by: Kevin Easton <kevin@guarana.org>
Reported-by: syzbot+5022a34ca5a3d49b84223653fab632dfb7b4cf37@syzkaller.appspotmail.com
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Zubin Mithra <zsm@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent b53761a commit 142b79a
1 file changed
Lines changed: 35 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
440 | 458 | | |
441 | 459 | | |
442 | 460 | | |
| |||
533 | 551 | | |
534 | 552 | | |
535 | 553 | | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
540 | 559 | | |
541 | 560 | | |
542 | | - | |
543 | | - | |
| 561 | + | |
| 562 | + | |
544 | 563 | | |
545 | 564 | | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
546 | 573 | | |
547 | 574 | | |
548 | 575 | | |
| |||
1111 | 1138 | | |
1112 | 1139 | | |
1113 | 1140 | | |
1114 | | - | |
1115 | | - | |
| 1141 | + | |
1116 | 1142 | | |
1117 | 1143 | | |
1118 | 1144 | | |
1119 | 1145 | | |
1120 | | - | |
1121 | | - | |
| 1146 | + | |
1122 | 1147 | | |
1123 | 1148 | | |
1124 | 1149 | | |
| |||
0 commit comments