Skip to content

Commit 7bc416f

Browse files
bulwahnummakynes
authored andcommitted
netfilter: x_tables: handle xt_register_template() returning an error value
Commit fdacd57 ("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 <[email protected]> Reviewed-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 6c89dac commit 7bc416f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv4/netfilter/iptable_mangle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ static int __init iptable_mangle_init(void)
112112
{
113113
int ret = xt_register_template(&packet_mangler,
114114
iptable_mangle_table_init);
115+
if (ret < 0)
116+
return ret;
115117

116118
mangle_ops = xt_hook_ops_alloc(&packet_mangler, iptable_mangle_hook);
117119
if (IS_ERR(mangle_ops)) {

0 commit comments

Comments
 (0)