netfilter: nf_tables: add missing ->release_ops() in error path of newrule()
->release_ops() callback releases resources and this is used in error path.
If nf_tables_newrule() fails after ->select_ops(), it should release
resources. but it can not call ->destroy() because that should be called
after ->init().
At this point, ->release_ops() should be used for releasing resources.
Test commands:
modprobe -rv xt_tcpudp
iptables-nft -I INPUT -m tcp <-- error command
lsmod
Result:
Module Size Used by
xt_tcpudp 20480 2 <-- it should be 0
Fixes: b8e2040063
("netfilter: nft_compat: use .release_ops and remove list of extension")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Родитель
7c9abe12b3
Коммит
b25a31bf0c
|
@ -2806,8 +2806,11 @@ err2:
|
||||||
nf_tables_rule_release(&ctx, rule);
|
nf_tables_rule_release(&ctx, rule);
|
||||||
err1:
|
err1:
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (info[i].ops != NULL)
|
if (info[i].ops) {
|
||||||
module_put(info[i].ops->type->owner);
|
module_put(info[i].ops->type->owner);
|
||||||
|
if (info[i].ops->type->release_ops)
|
||||||
|
info[i].ops->type->release_ops(info[i].ops);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
kvfree(info);
|
kvfree(info);
|
||||||
return err;
|
return err;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче