aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2013-02-11 18:22:38 -0500
committerPablo Neira Ayuso <pablo@gnumonks.org>2013-02-12 17:18:15 -0500
commit442fad9423b78319e0019a7f5047eddf3317afbc (patch)
tree7668d4cdb5ba8400065f8464d708b9541e61a073 /net/netfilter
parent547b4e718115eea74087e28d7fa70aec619200db (diff)
netfilter: ctnetlink: don't permit ct creation with random tuple
Userspace can cause kernel panic by not specifying orig/reply tuple: kernel will create a tuple with random stack values. Problem is that tuple.dst.dir will be random, too, which causes nf_ct_tuplehash_to_ctrack() to return garbage. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_conntrack_netlink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 627b0e50b238..a081915e0531 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1705,6 +1705,9 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1705 if (nlh->nlmsg_flags & NLM_F_CREATE) { 1705 if (nlh->nlmsg_flags & NLM_F_CREATE) {
1706 enum ip_conntrack_events events; 1706 enum ip_conntrack_events events;
1707 1707
1708 if (!cda[CTA_TUPLE_ORIG] || !cda[CTA_TUPLE_REPLY])
1709 return -EINVAL;
1710
1708 ct = ctnetlink_create_conntrack(net, zone, cda, &otuple, 1711 ct = ctnetlink_create_conntrack(net, zone, cda, &otuple,
1709 &rtuple, u3); 1712 &rtuple, u3);
1710 if (IS_ERR(ct)) 1713 if (IS_ERR(ct))