From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: stable@vger.kernel.org, Eric Dumazet <edumazet@google.com>
Subject: [PATCH -stable,4.3.y] netfilter: xt_TEE: fix NULL dereference
Date: Fri, 6 Nov 2015 13:44:44 +0100 [thread overview]
Message-ID: <1446813886-5632-2-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1446813886-5632-1-git-send-email-pablo@netfilter.org>
From: Eric Dumazet <edumazet@google.com>
[ upstream commit 45efccdbec3cd465c4776ed9ca1d7b1bba1b7e34 ]
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: bbde9fc1824a ("netfilter: factor out packet duplication for IPv4/IPv6")
Cc: <stable@vger.kernel.org> # 4.3.x
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/xt_TEE.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index fd980aa..c5fdea1 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -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;
}
@@ -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;
}
--
2.1.4
next prev parent reply other threads:[~2015-11-06 12:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 12:44 [PATCH -stable,4.x.y] netfilter: nf_nat_redirect: add missing NULL pointer check Pablo Neira Ayuso
2015-11-06 12:44 ` Pablo Neira Ayuso [this message]
2015-11-06 17:09 ` [PATCH -stable,4.3.y] netfilter: xt_TEE: fix NULL dereference Greg KH
2015-11-06 17:26 ` Pablo Neira Ayuso
2015-11-07 16:04 ` Ben Hutchings
2015-11-07 16:39 ` Pablo Neira Ayuso
2015-11-06 12:44 ` [PATCH -stable,3.4.y] netfilter: nf_conntrack: fix RCU race in nf_conntrack_find_get Pablo Neira Ayuso
2015-11-06 17:09 ` Greg KH
2015-11-06 17:27 ` Pablo Neira Ayuso
2015-11-06 20:30 ` Ani Sinha
2015-11-06 22:11 ` Greg KH
2015-11-06 22:27 ` Ani Sinha
2015-11-07 6:28 ` Zefan Li
2015-11-14 17:30 ` Ben Hutchings
2015-11-06 12:44 ` [PATCH -stable,backport,3.4.y] netfilter: nf_conntrack: don't release a conntrack with non-zero refcnt Pablo Neira Ayuso
2015-11-06 17:08 ` [PATCH -stable,4.x.y] netfilter: nf_nat_redirect: add missing NULL pointer check Greg KH
2015-11-06 17:26 ` Pablo Neira Ayuso
2016-01-18 19:27 ` Munehisa Kamata
2016-01-18 19:47 ` Pablo Neira Ayuso
2016-01-18 19:48 ` Pablo Neira Ayuso
2016-01-19 3:26 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2015-11-16 11:00 Pablo Neira Ayuso
2015-11-16 11:00 ` [PATCH -stable,4.3.y] netfilter: xt_TEE: fix NULL dereference Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446813886-5632-2-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=edumazet@google.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).