Skip to content

Commit d5b8aff

Browse files
author
Paolo Abeni
committed
Merge tag 'nf-24-03-07' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf
Pablo Neira Ayuso says: ==================== Netfilter fixes for net The following patchset contains fixes for net: Patch #1 disallows anonymous sets with timeout, except for dynamic sets. Anonymous sets with timeouts using the pipapo set backend makes no sense from userspace perspective. Patch #2 rejects constant sets with timeout which has no practical usecase. This kind of set, once bound, contains elements that expire but no new elements can be added. Patch #3 restores custom conntrack expectations with NFPROTO_INET, from Florian Westphal. Patch #4 marks rhashtable anonymous set with timeout as dead from the commit path to avoid that async GC collects these elements. Rules that refers to the anonymous set get released with no mutex held from the commit path. Patch #5 fixes a UBSAN shift overflow in H.323 conntrack helper, from Lena Wang. netfilter pull request 24-03-07 * tag 'nf-24-03-07' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf: netfilter: nf_conntrack_h323: Add protection for bmp length out of range netfilter: nf_tables: mark set as dead when unbinding anonymous set with timeout netfilter: nft_ct: fix l3num expectations with inet pseudo family netfilter: nf_tables: reject constant set with timeout netfilter: nf_tables: disallow anonymous set with timeout flag ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 6d673e8 + 7671466 commit d5b8aff

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

net/netfilter/nf_conntrack_h323_asn1.c

+4
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,8 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
533533
/* Get fields bitmap */
534534
if (nf_h323_error_boundary(bs, 0, f->sz))
535535
return H323_ERROR_BOUND;
536+
if (f->sz > 32)
537+
return H323_ERROR_RANGE;
536538
bmp = get_bitmap(bs, f->sz);
537539
if (base)
538540
*(unsigned int *)base = bmp;
@@ -589,6 +591,8 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
589591
bmp2_len = get_bits(bs, 7) + 1;
590592
if (nf_h323_error_boundary(bs, 0, bmp2_len))
591593
return H323_ERROR_BOUND;
594+
if (bmp2_len > 32)
595+
return H323_ERROR_RANGE;
592596
bmp2 = get_bitmap(bs, bmp2_len);
593597
bmp |= bmp2 >> f->sz;
594598
if (base)

net/netfilter/nf_tables_api.c

+7
Original file line numberDiff line numberDiff line change
@@ -5001,6 +5001,12 @@ static int nf_tables_newset(struct sk_buff *skb, const struct nfnl_info *info,
50015001
if ((flags & (NFT_SET_EVAL | NFT_SET_OBJECT)) ==
50025002
(NFT_SET_EVAL | NFT_SET_OBJECT))
50035003
return -EOPNOTSUPP;
5004+
if ((flags & (NFT_SET_ANONYMOUS | NFT_SET_TIMEOUT | NFT_SET_EVAL)) ==
5005+
(NFT_SET_ANONYMOUS | NFT_SET_TIMEOUT))
5006+
return -EOPNOTSUPP;
5007+
if ((flags & (NFT_SET_CONSTANT | NFT_SET_TIMEOUT)) ==
5008+
(NFT_SET_CONSTANT | NFT_SET_TIMEOUT))
5009+
return -EOPNOTSUPP;
50045010
}
50055011

50065012
desc.dtype = 0;
@@ -5424,6 +5430,7 @@ static void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set,
54245430

54255431
if (list_empty(&set->bindings) && nft_set_is_anonymous(set)) {
54265432
list_del_rcu(&set->list);
5433+
set->dead = 1;
54275434
if (event)
54285435
nf_tables_set_notify(ctx, set, NFT_MSG_DELSET,
54295436
GFP_KERNEL);

net/netfilter/nft_ct.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -1256,14 +1256,13 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx,
12561256
switch (priv->l3num) {
12571257
case NFPROTO_IPV4:
12581258
case NFPROTO_IPV6:
1259-
if (priv->l3num != ctx->family)
1260-
return -EINVAL;
1259+
if (priv->l3num == ctx->family || ctx->family == NFPROTO_INET)
1260+
break;
12611261

1262-
fallthrough;
1263-
case NFPROTO_INET:
1264-
break;
1262+
return -EINVAL;
1263+
case NFPROTO_INET: /* tuple.src.l3num supports NFPROTO_IPV4/6 only */
12651264
default:
1266-
return -EOPNOTSUPP;
1265+
return -EAFNOSUPPORT;
12671266
}
12681267

12691268
priv->l4proto = nla_get_u8(tb[NFTA_CT_EXPECT_L4PROTO]);

0 commit comments

Comments
 (0)