projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
acd43fe
)
netfilter: nf_tables: fix memory leak if expr init fails
author
Liping Zhang
<liping.zhang@spreadtrum.com>
Mon, 20 Jun 2016 13:11:45 +0000
(21:11 +0800)
committer
Pablo Neira Ayuso
<pablo@netfilter.org>
Thu, 23 Jun 2016 12:15:24 +0000
(14:15 +0200)
If expr init fails then we need to free it.
So when the user add a nft rule as follows:
# nft add rule filter input tcp dport 22 flow table ssh \
{ ip saddr limit rate 0/second }
memory leak will happen.
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c
patch
|
blob
|
history
diff --git
a/net/netfilter/nf_tables_api.c
b/net/netfilter/nf_tables_api.c
index 2c881871db381c1142cb3a0591850325b75fa619..cf7c74599cbe5e6b800b584bee75d60f62d84a73 100644
(file)
--- a/
net/netfilter/nf_tables_api.c
+++ b/
net/netfilter/nf_tables_api.c
@@
-1724,9
+1724,11
@@
struct nft_expr *nft_expr_init(const struct nft_ctx *ctx,
err = nf_tables_newexpr(ctx, &info, expr);
if (err < 0)
- goto err
2
;
+ goto err
3
;
return expr;
+err3:
+ kfree(expr);
err2:
module_put(info.ops->type->owner);
err1: