Commit 36983fc
netfilter: nf_tables: initialize set before expression setup
commit ad9f151 upstream.
nft_set_elem_expr_alloc() needs an initialized set if expression sets on
the NFT_EXPR_GC flag. Move set fields initialization before expression
setup.
[4512935.019450] ==================================================================
[4512935.019456] BUG: KASAN: null-ptr-deref in nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables]
[4512935.019487] Read of size 8 at addr 0000000000000070 by task nft/23532
[4512935.019494] CPU: 1 PID: 23532 Comm: nft Not tainted 5.12.0-rc4+ #48
[...]
[4512935.019502] Call Trace:
[4512935.019505] dump_stack+0x89/0xb4
[4512935.019512] ? nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables]
[4512935.019536] ? nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables]
[4512935.019560] kasan_report.cold.12+0x5f/0xd8
[4512935.019566] ? nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables]
[4512935.019590] nft_set_elem_expr_alloc+0x84/0xd0 [nf_tables]
[4512935.019615] nf_tables_newset+0xc7f/0x1460 [nf_tables]
Reported-by: syzbot+ce96ca2b1d0b37c6422d@syzkaller.appspotmail.com
Fixes: 6503842 ("netfilter: nf_tables: allow to specify stateful expression in set definition")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 3fda454 commit 36983fc
1 file changed
+24
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4280 | 4280 | | |
4281 | 4281 | | |
4282 | 4282 | | |
4283 | | - | |
4284 | | - | |
4285 | | - | |
4286 | | - | |
4287 | | - | |
4288 | | - | |
4289 | | - | |
4290 | | - | |
4291 | | - | |
| 4283 | + | |
4292 | 4284 | | |
4293 | 4285 | | |
4294 | 4286 | | |
| |||
4299 | 4291 | | |
4300 | 4292 | | |
4301 | 4293 | | |
4302 | | - | |
| 4294 | + | |
4303 | 4295 | | |
4304 | | - | |
| 4296 | + | |
4305 | 4297 | | |
4306 | 4298 | | |
4307 | | - | |
4308 | | - | |
| 4299 | + | |
4309 | 4300 | | |
4310 | | - | |
| 4301 | + | |
4311 | 4302 | | |
4312 | | - | |
4313 | | - | |
| 4303 | + | |
| 4304 | + | |
4314 | 4305 | | |
4315 | 4306 | | |
4316 | | - | |
4317 | 4307 | | |
4318 | 4308 | | |
4319 | 4309 | | |
| |||
4323 | 4313 | | |
4324 | 4314 | | |
4325 | 4315 | | |
| 4316 | + | |
| 4317 | + | |
| 4318 | + | |
| 4319 | + | |
| 4320 | + | |
| 4321 | + | |
| 4322 | + | |
| 4323 | + | |
| 4324 | + | |
| 4325 | + | |
| 4326 | + | |
| 4327 | + | |
4326 | 4328 | | |
4327 | 4329 | | |
4328 | | - | |
| 4330 | + | |
4329 | 4331 | | |
4330 | 4332 | | |
4331 | 4333 | | |
4332 | 4334 | | |
4333 | 4335 | | |
4334 | | - | |
| 4336 | + | |
| 4337 | + | |
| 4338 | + | |
| 4339 | + | |
4335 | 4340 | | |
4336 | 4341 | | |
4337 | | - | |
4338 | | - | |
4339 | | - | |
4340 | 4342 | | |
4341 | 4343 | | |
4342 | 4344 | | |
| |||
0 commit comments