Commit 7f066cb
netfilter: nf_tables: fix memory leak in nf_tables_newrule()
[ Upstream commit d077e81 ]
In nf_tables_newrule(), if nft_use_inc() fails, the function jumps to
the err_release_rule label without freeing the allocated flow, leading
to a memory leak.
Fix this by adding a new label err_destroy_flow and jumping to it when
nft_use_inc() fails. This ensures that the flow is properly released
in this error case.
Fixes: 1689f25 ("netfilter: nf_tables: report use refcount overflow")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 58dac9b commit 7f066cb
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4378 | 4378 | | |
4379 | 4379 | | |
4380 | 4380 | | |
4381 | | - | |
| 4381 | + | |
4382 | 4382 | | |
4383 | 4383 | | |
4384 | 4384 | | |
| |||
4428 | 4428 | | |
4429 | 4429 | | |
4430 | 4430 | | |
| 4431 | + | |
4431 | 4432 | | |
4432 | 4433 | | |
4433 | 4434 | | |
| |||
0 commit comments