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 net:

1) Fix UAF in set catch-all element, from Eric Dumazet.

2) Fix MAC mangling for multicast/loopback traffic in nfnetlink_queue
   and nfnetlink_log, from Ignacy Gawędzki.

3) Remove expired entries from ctnetlink dump path regardless the tuple
   direction, from Florian Westphal.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2021-12-17 10:52:04 +00:00
commit 8ca4090fec
4 changed files with 9 additions and 6 deletions

View File

@ -1195,8 +1195,6 @@ restart:
} }
hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[cb->args[0]], hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[cb->args[0]],
hnnode) { hnnode) {
if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
continue;
ct = nf_ct_tuplehash_to_ctrack(h); ct = nf_ct_tuplehash_to_ctrack(h);
if (nf_ct_is_expired(ct)) { if (nf_ct_is_expired(ct)) {
if (i < ARRAY_SIZE(nf_ct_evict) && if (i < ARRAY_SIZE(nf_ct_evict) &&
@ -1208,6 +1206,9 @@ restart:
if (!net_eq(net, nf_ct_net(ct))) if (!net_eq(net, nf_ct_net(ct)))
continue; continue;
if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
continue;
if (cb->args[1]) { if (cb->args[1]) {
if (ct != last) if (ct != last)
continue; continue;

View File

@ -4481,9 +4481,9 @@ struct nft_set_elem_catchall {
static void nft_set_catchall_destroy(const struct nft_ctx *ctx, static void nft_set_catchall_destroy(const struct nft_ctx *ctx,
struct nft_set *set) struct nft_set *set)
{ {
struct nft_set_elem_catchall *catchall; struct nft_set_elem_catchall *next, *catchall;
list_for_each_entry_rcu(catchall, &set->catchall_list, list) { list_for_each_entry_safe(catchall, next, &set->catchall_list, list) {
list_del_rcu(&catchall->list); list_del_rcu(&catchall->list);
nft_set_elem_destroy(set, catchall->elem, true); nft_set_elem_destroy(set, catchall->elem, true);
kfree_rcu(catchall); kfree_rcu(catchall);

View File

@ -556,7 +556,8 @@ __build_packet_message(struct nfnl_log_net *log,
goto nla_put_failure; goto nla_put_failure;
if (indev && skb->dev && if (indev && skb->dev &&
skb->mac_header != skb->network_header) { skb_mac_header_was_set(skb) &&
skb_mac_header_len(skb) != 0) {
struct nfulnl_msg_packet_hw phw; struct nfulnl_msg_packet_hw phw;
int len; int len;

View File

@ -560,7 +560,8 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
goto nla_put_failure; goto nla_put_failure;
if (indev && entskb->dev && if (indev && entskb->dev &&
skb_mac_header_was_set(entskb)) { skb_mac_header_was_set(entskb) &&
skb_mac_header_len(entskb) != 0) {
struct nfqnl_msg_packet_hw phw; struct nfqnl_msg_packet_hw phw;
int len; int len;