Commit 65acf6e
netfilter: complete validation of user input
In my recent commit, I missed that do_replace() handlers
use copy_from_sockptr() (which I fixed), followed
by unsafe copy_from_sockptr_offset() calls.
In all functions, we can perform the @optlen validation
before even calling xt_alloc_table_info() with the following
check:
if ((u64)optlen < (u64)tmp.size + sizeof(tmp))
return -EINVAL;
Fixes: 0c83842 ("netfilter: validate user input for expected length")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
Link: https://lore.kernel.org/r/20240409120741.3538135-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 97e176f commit 65acf6e
3 files changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
| 970 | + | |
969 | 971 | | |
970 | 972 | | |
971 | 973 | | |
| |||
1266 | 1268 | | |
1267 | 1269 | | |
1268 | 1270 | | |
| 1271 | + | |
| 1272 | + | |
1269 | 1273 | | |
1270 | 1274 | | |
1271 | 1275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1118 | 1118 | | |
1119 | 1119 | | |
1120 | 1120 | | |
| 1121 | + | |
| 1122 | + | |
1121 | 1123 | | |
1122 | 1124 | | |
1123 | 1125 | | |
| |||
1504 | 1506 | | |
1505 | 1507 | | |
1506 | 1508 | | |
| 1509 | + | |
| 1510 | + | |
1507 | 1511 | | |
1508 | 1512 | | |
1509 | 1513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1135 | 1135 | | |
1136 | 1136 | | |
1137 | 1137 | | |
| 1138 | + | |
| 1139 | + | |
1138 | 1140 | | |
1139 | 1141 | | |
1140 | 1142 | | |
| |||
1513 | 1515 | | |
1514 | 1516 | | |
1515 | 1517 | | |
| 1518 | + | |
| 1519 | + | |
1516 | 1520 | | |
1517 | 1521 | | |
1518 | 1522 | | |
| |||
0 commit comments