aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/iptable_mangle.c
diff options
context:
space:
mode:
authorLukas Bulwahn <lukas.bulwahn@gmail.com>2021-08-23 22:27:29 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2021-08-25 13:06:48 +0200
commit7bc416f1471686faa8030cd5338f6a5370e01b25 (patch)
tree0d18b7a88694131866837e0626ae48d78b21a2df /net/ipv4/netfilter/iptable_mangle.c
parentnetfilter: ctnetlink: missing counters and timestamp in nfnetlink_{log,queue} (diff)
downloadlinux-dev-7bc416f1471686faa8030cd5338f6a5370e01b25.tar.xz
linux-dev-7bc416f1471686faa8030cd5338f6a5370e01b25.zip
netfilter: x_tables: handle xt_register_template() returning an error value
Commit fdacd57c79b7 ("netfilter: x_tables: never register tables by default") introduces the function xt_register_template(), and in one case, a call to that function was missing the error-case handling. Handle when xt_register_template() returns an error value. This was identified with the clang-analyzer's Dead-Store analysis. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4/netfilter/iptable_mangle.c')
-rw-r--r--net/ipv4/netfilter/iptable_mangle.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
index b52a4c8a14fc..40417a3f930b 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -112,6 +112,8 @@ static int __init iptable_mangle_init(void)
{
int ret = xt_register_template(&packet_mangler,
iptable_mangle_table_init);
+ if (ret < 0)
+ return ret;
mangle_ops = xt_hook_ops_alloc(&packet_mangler, iptable_mangle_hook);
if (IS_ERR(mangle_ops)) {