History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf

Pablo Neira Ayuso says: ==================== Netfilter fixes for net The following patchset contains Netfilter fixes for your net tree, they are: 1) Use mod_timer_pending() to avoid reactivating a dead expectation in the h323 conntrack helper, from Liping Zhang. 2) Oneliner to fix a type in the register name defined in the nf_tables header. 3) Don't try to look further when we find an inactive elements with no descendants in the rbtree set implementation, otherwise we crash. 4) Handle valid zero CSeq in the SIP conntrack helper, from Christophe Leroy. 5) Don't display a trailing slash in conntrack helper with no classes via /proc/net/nf_conntrack_expect, from Liping Zhang. 6) Fix an expectation leak during creation from the nfqueue path, again from Liping Zhang. 7) Validate netlink port ID in verdict message from nfqueue, otherwise an injection can be possible. Again from Zhang. 8) Reject conntrack tuples with different transport protocol on original and reply tuples, also from Zhang. 9) Validate offset and length in nft_exthdr, make sure they are under sizeof(u8), from Laura Garcia Liebana. ====================

David S. Miller committed 10 years ago

Commit 293fddf2 parents 7bb90c3 4da449a8 files · +27 −21Browse files

Unified · Split

8 files
  1. include/uapi/linux/netfilter/nf_tables.h +1 −1
  2. net/netfilter/nf_conntrack_expect.c +1 −1
  3. net/netfilter/nf_conntrack_h323_main.c +2 −1
  4. net/netfilter/nf_conntrack_netlink.c +4 −6
  5. net/netfilter/nf_conntrack_sip.c +2 −2
  6. net/netfilter/nfnetlink_queue.c +2 −4
  7. net/netfilter/nft_exthdr.c +9 −2
  8. net/netfilter/nft_rbtree.c +6 −4
include/uapi/linux/netfilter/nf_tables.h+1−1
@@ -24,7 +24,7 @@ enum nft_registers { · 23 unmodified lines
24 __NFT_REG_MAX,24 __NFT_REG_MAX,
25 25
26 NFT_REG32_00 = 8,26 NFT_REG32_00 = 8,
27 MFT_REG32_01,27 NFT_REG32_01,
28 NFT_REG32_02,28 NFT_REG32_02,
29 NFT_REG32_03,29 NFT_REG32_03,
30 NFT_REG32_04,30 NFT_REG32_04,
net/netfilter/nf_conntrack_expect.c+1−1
@@ -574,7 +574,7 @@ static int exp_seq_show(struct seq_file *s, void *v) · 573 unmodified lines
574 helper = rcu_dereference(nfct_help(expect->master)->helper);574 helper = rcu_dereference(nfct_help(expect->master)->helper);
575 if (helper) {575 if (helper) {
576 seq_printf(s, "%s%s", expect->flags ? " " : "", helper->name);576 seq_printf(s, "%s%s", expect->flags ? " " : "", helper->name);
577 if (helper->expect_policy[expect->class].name)577 if (helper->expect_policy[expect->class].name[0])
578 seq_printf(s, "/%s",578 seq_printf(s, "/%s",
579 helper->expect_policy[expect->class].name);579 helper->expect_policy[expect->class].name);
580 }580 }
net/netfilter/nf_conntrack_h323_main.c+2−1
@@ -1473,7 +1473,8 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct, · 1472 unmodified lines
1473 "timeout to %u seconds for",1473 "timeout to %u seconds for",
1474 info->timeout);1474 info->timeout);
1475 nf_ct_dump_tuple(&exp->tuple);1475 nf_ct_dump_tuple(&exp->tuple);
1476 mod_timer(&exp->timeout, jiffies + info->timeout * HZ);1476 mod_timer_pending(&exp->timeout,
1477 jiffies + info->timeout * HZ);
1477 }1478 }
1478 spin_unlock_bh(&nf_conntrack_expect_lock);1479 spin_unlock_bh(&nf_conntrack_expect_lock);
1479 }1480 }
net/netfilter/nf_conntrack_netlink.c+4−6
@@ -1894,6 +1894,8 @@ static int ctnetlink_new_conntrack(struct net *net, struct sock *ctnl, · 1893 unmodified lines
1894 1894
1895 if (!cda[CTA_TUPLE_ORIG] || !cda[CTA_TUPLE_REPLY])1895 if (!cda[CTA_TUPLE_ORIG] || !cda[CTA_TUPLE_REPLY])
1896 return -EINVAL;1896 return -EINVAL;
1897 if (otuple.dst.protonum != rtuple.dst.protonum)
1898 return -EINVAL;
1897 1899
1898 ct = ctnetlink_create_conntrack(net, &zone, cda, &otuple,1900 ct = ctnetlink_create_conntrack(net, &zone, cda, &otuple,
1899 &rtuple, u3);1901 &rtuple, u3);
@@ -2362,12 +2364,8 @@ ctnetlink_glue_attach_expect(const struct nlattr *attr, struct nf_conn *ct, · 462 unmodified lines
2362 return PTR_ERR(exp);2364 return PTR_ERR(exp);
2363 2365
2364 err = nf_ct_expect_related_report(exp, portid, report);2366 err = nf_ct_expect_related_report(exp, portid, report);
2365 if (err < 0) {2367 nf_ct_expect_put(exp);
2366 nf_ct_expect_put(exp);2368 return err;
2367 return err;
2368 }
2369
2370 return 0;
2371}2369}
2372 2370
2373static void ctnetlink_glue_seqadj(struct sk_buff *skb, struct nf_conn *ct,2371static void ctnetlink_glue_seqadj(struct sk_buff *skb, struct nf_conn *ct,
net/netfilter/nf_conntrack_sip.c+2−2
@@ -1383,7 +1383,7 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff, · 1382 unmodified lines
1383 return NF_DROP;1383 return NF_DROP;
1384 }1384 }
1385 cseq = simple_strtoul(*dptr + matchoff, NULL, 10);1385 cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
1386 if (!cseq) {1386 if (!cseq && *(*dptr + matchoff) != '0') {
1387 nf_ct_helper_log(skb, ct, "cannot get cseq");1387 nf_ct_helper_log(skb, ct, "cannot get cseq");
1388 return NF_DROP;1388 return NF_DROP;
1389 }1389 }
@@ -1446,7 +1446,7 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff, · 56 unmodified lines
1446 return NF_DROP;1446 return NF_DROP;
1447 }1447 }
1448 cseq = simple_strtoul(*dptr + matchoff, NULL, 10);1448 cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
1449 if (!cseq) {1449 if (!cseq && *(*dptr + matchoff) != '0') {
1450 nf_ct_helper_log(skb, ct, "cannot get cseq");1450 nf_ct_helper_log(skb, ct, "cannot get cseq");
1451 return NF_DROP;1451 return NF_DROP;
1452 }1452 }
net/netfilter/nfnetlink_queue.c+2−4
@@ -1145,10 +1145,8 @@ static int nfqnl_recv_verdict(struct net *net, struct sock *ctnl, · 1144 unmodified lines
1145 struct nfnl_queue_net *q = nfnl_queue_pernet(net);1145 struct nfnl_queue_net *q = nfnl_queue_pernet(net);
1146 int err;1146 int err;
1147 1147
1148 queue = instance_lookup(q, queue_num);1148 queue = verdict_instance_lookup(q, queue_num,
1149 if (!queue)1149 NETLINK_CB(skb).portid);
1150 queue = verdict_instance_lookup(q, queue_num,
1151 NETLINK_CB(skb).portid);
1152 if (IS_ERR(queue))1150 if (IS_ERR(queue))
1153 return PTR_ERR(queue);1151 return PTR_ERR(queue);
1154 1152
net/netfilter/nft_exthdr.c+9−2
@@ -59,6 +59,7 @@ static int nft_exthdr_init(const struct nft_ctx *ctx, · 58 unmodified lines
59 const struct nlattr * const tb[])59 const struct nlattr * const tb[])
60{60{
61 struct nft_exthdr *priv = nft_expr_priv(expr);61 struct nft_exthdr *priv = nft_expr_priv(expr);
62 u32 offset, len;
62 63
63 if (tb[NFTA_EXTHDR_DREG] == NULL ||64 if (tb[NFTA_EXTHDR_DREG] == NULL ||
64 tb[NFTA_EXTHDR_TYPE] == NULL ||65 tb[NFTA_EXTHDR_TYPE] == NULL ||
@@ -66,9 +67,15 @@ static int nft_exthdr_init(const struct nft_ctx *ctx, · 1 unmodified line
66 tb[NFTA_EXTHDR_LEN] == NULL)67 tb[NFTA_EXTHDR_LEN] == NULL)
67 return -EINVAL;68 return -EINVAL;
68 69
70 offset = ntohl(nla_get_be32(tb[NFTA_EXTHDR_OFFSET]));
71 len = ntohl(nla_get_be32(tb[NFTA_EXTHDR_LEN]));
72
73 if (offset > U8_MAX || len > U8_MAX)
74 return -ERANGE;
75
69 priv->type = nla_get_u8(tb[NFTA_EXTHDR_TYPE]);76 priv->type = nla_get_u8(tb[NFTA_EXTHDR_TYPE]);
70 priv->offset = ntohl(nla_get_be32(tb[NFTA_EXTHDR_OFFSET]));77 priv->offset = offset;
71 priv->len = ntohl(nla_get_be32(tb[NFTA_EXTHDR_LEN]));78 priv->len = len;
72 priv->dreg = nft_parse_register(tb[NFTA_EXTHDR_DREG]);79 priv->dreg = nft_parse_register(tb[NFTA_EXTHDR_DREG]);
73 80
74 return nft_validate_register_store(ctx, priv->dreg, NULL,81 return nft_validate_register_store(ctx, priv->dreg, NULL,
net/netfilter/nft_rbtree.c+6−4
@@ -70,7 +70,6 @@ static bool nft_rbtree_lookup(const struct net *net, const struct nft_set *set, · 69 unmodified lines
70 } else if (d > 0)70 } else if (d > 0)
71 parent = parent->rb_right;71 parent = parent->rb_right;
72 else {72 else {
73found:
74 if (!nft_set_elem_active(&rbe->ext, genmask)) {73 if (!nft_set_elem_active(&rbe->ext, genmask)) {
75 parent = parent->rb_left;74 parent = parent->rb_left;
76 continue;75 continue;
@@ -84,9 +83,12 @@ found: · 7 unmodified lines
84 }83 }
85 }84 }
86 85
87 if (set->flags & NFT_SET_INTERVAL && interval != NULL) {86 if (set->flags & NFT_SET_INTERVAL && interval != NULL &&
88 rbe = interval;87 nft_set_elem_active(&interval->ext, genmask) &&
89 goto found;88 !nft_rbtree_interval_end(interval)) {
89 spin_unlock_bh(&nft_rbtree_lock);
90 *ext = &interval->ext;
91 return true;
90 }92 }
91out:93out:
92 spin_unlock_bh(&nft_rbtree_lock);94 spin_unlock_bh(&nft_rbtree_lock);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t