Skip to content

Commit 8ca4090

Browse files
committed
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 <[email protected]>
2 parents b62e331 + 76f12e6 commit 8ca4090

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

net/netfilter/nf_conntrack_netlink.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,6 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
11951195
}
11961196
hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[cb->args[0]],
11971197
hnnode) {
1198-
if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
1199-
continue;
12001198
ct = nf_ct_tuplehash_to_ctrack(h);
12011199
if (nf_ct_is_expired(ct)) {
12021200
if (i < ARRAY_SIZE(nf_ct_evict) &&
@@ -1208,6 +1206,9 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
12081206
if (!net_eq(net, nf_ct_net(ct)))
12091207
continue;
12101208

1209+
if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
1210+
continue;
1211+
12111212
if (cb->args[1]) {
12121213
if (ct != last)
12131214
continue;

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4481,9 +4481,9 @@ struct nft_set_elem_catchall {
44814481
static void nft_set_catchall_destroy(const struct nft_ctx *ctx,
44824482
struct nft_set *set)
44834483
{
4484-
struct nft_set_elem_catchall *catchall;
4484+
struct nft_set_elem_catchall *next, *catchall;
44854485

4486-
list_for_each_entry_rcu(catchall, &set->catchall_list, list) {
4486+
list_for_each_entry_safe(catchall, next, &set->catchall_list, list) {
44874487
list_del_rcu(&catchall->list);
44884488
nft_set_elem_destroy(set, catchall->elem, true);
44894489
kfree_rcu(catchall);

net/netfilter/nfnetlink_log.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ __build_packet_message(struct nfnl_log_net *log,
556556
goto nla_put_failure;
557557

558558
if (indev && skb->dev &&
559-
skb->mac_header != skb->network_header) {
559+
skb_mac_header_was_set(skb) &&
560+
skb_mac_header_len(skb) != 0) {
560561
struct nfulnl_msg_packet_hw phw;
561562
int len;
562563

net/netfilter/nfnetlink_queue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,
560560
goto nla_put_failure;
561561

562562
if (indev && entskb->dev &&
563-
skb_mac_header_was_set(entskb)) {
563+
skb_mac_header_was_set(entskb) &&
564+
skb_mac_header_len(entskb) != 0) {
564565
struct nfqnl_msg_packet_hw phw;
565566
int len;
566567

0 commit comments

Comments
 (0)