Skip to content

Commit

Permalink
netfilter: xt_TEE: fix NULL dereference
Browse files Browse the repository at this point in the history
iptables -I INPUT ... -j TEE --gateway 10.1.2.3

<crash> because --oif was not specified

tee_tg_check() sets ->priv pointer to NULL in this case.

Fixes: bbde9fc ("netfilter: factor out packet duplication for IPv4/IPv6")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Eric Dumazet authored and Pablo Neira Ayuso committed Oct 22, 2015
1 parent 104eb27 commit 45efccd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/netfilter/xt_TEE.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ static unsigned int
tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct xt_tee_tginfo *info = par->targinfo;
int oif = info->priv ? info->priv->oif : 0;

nf_dup_ipv4(skb, par->hooknum, &info->gw.in, info->priv->oif);
nf_dup_ipv4(skb, par->hooknum, &info->gw.in, oif);

return XT_CONTINUE;
}
Expand All @@ -42,8 +43,9 @@ static unsigned int
tee_tg6(struct sk_buff *skb, const struct xt_action_param *par)
{
const struct xt_tee_tginfo *info = par->targinfo;
int oif = info->priv ? info->priv->oif : 0;

nf_dup_ipv6(skb, par->hooknum, &info->gw.in6, info->priv->oif);
nf_dup_ipv6(skb, par->hooknum, &info->gw.in6, oif);

return XT_CONTINUE;
}
Expand Down

0 comments on commit 45efccd

Please sign in to comment.