Commit ad9f151
committed
netfilter: nf_tables: initialize set before expression setup
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>1 parent f2386cf commit ad9f151
1 file changed
+43
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4364 | 4364 | | |
4365 | 4365 | | |
4366 | 4366 | | |
4367 | | - | |
| 4367 | + | |
| 4368 | + | |
| 4369 | + | |
| 4370 | + | |
| 4371 | + | |
| 4372 | + | |
| 4373 | + | |
| 4374 | + | |
| 4375 | + | |
| 4376 | + | |
| 4377 | + | |
| 4378 | + | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
| 4393 | + | |
| 4394 | + | |
| 4395 | + | |
| 4396 | + | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
4368 | 4400 | | |
4369 | 4401 | | |
4370 | 4402 | | |
4371 | 4403 | | |
4372 | 4404 | | |
4373 | | - | |
| 4405 | + | |
4374 | 4406 | | |
4375 | 4407 | | |
4376 | 4408 | | |
| |||
4381 | 4413 | | |
4382 | 4414 | | |
4383 | 4415 | | |
4384 | | - | |
| 4416 | + | |
4385 | 4417 | | |
4386 | 4418 | | |
4387 | 4419 | | |
4388 | 4420 | | |
4389 | 4421 | | |
4390 | | - | |
| 4422 | + | |
4391 | 4423 | | |
4392 | 4424 | | |
4393 | 4425 | | |
4394 | | - | |
| 4426 | + | |
4395 | 4427 | | |
4396 | 4428 | | |
4397 | 4429 | | |
4398 | 4430 | | |
4399 | | - | |
| 4431 | + | |
4400 | 4432 | | |
4401 | 4433 | | |
4402 | 4434 | | |
4403 | 4435 | | |
4404 | 4436 | | |
4405 | 4437 | | |
4406 | | - | |
4407 | | - | |
4408 | | - | |
4409 | | - | |
4410 | | - | |
4411 | | - | |
4412 | | - | |
4413 | | - | |
4414 | | - | |
4415 | | - | |
4416 | | - | |
4417 | | - | |
4418 | | - | |
4419 | | - | |
4420 | | - | |
4421 | | - | |
4422 | | - | |
4423 | | - | |
4424 | | - | |
4425 | | - | |
4426 | | - | |
4427 | | - | |
4428 | | - | |
4429 | 4438 | | |
4430 | 4439 | | |
4431 | | - | |
4432 | | - | |
4433 | | - | |
4434 | | - | |
4435 | | - | |
4436 | | - | |
4437 | | - | |
4438 | | - | |
4439 | 4440 | | |
4440 | 4441 | | |
4441 | | - | |
| 4442 | + | |
4442 | 4443 | | |
4443 | 4444 | | |
4444 | 4445 | | |
4445 | 4446 | | |
4446 | 4447 | | |
4447 | | - | |
4448 | | - | |
4449 | | - | |
| 4448 | + | |
4450 | 4449 | | |
4451 | 4450 | | |
4452 | | - | |
| 4451 | + | |
| 4452 | + | |
| 4453 | + | |
4453 | 4454 | | |
4454 | 4455 | | |
4455 | 4456 | | |
| |||
0 commit comments