* [PATCH net 0/6,v2] Netfilter fixes for net
@ 2024-05-23 16:20 Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 1/6] netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu() Pablo Neira Ayuso
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-23 16:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
v2: fixes sparse warnings due to incorrect endianness in vlan mangling fix
reported by kbuild robot and Paolo Abeni.
-o-
Hi,
The following patchset contains Netfilter fixes for net:
Patch #1 syzbot reports that nf_reinject() could be called without
rcu_read_lock() when flushing pending packets at nfnetlink
queue removal, from Eric Dumazet.
Patch #2 flushes ipset list:set when canceling garbage collection to
reference to other lists to fix a race, from Jozsef Kadlecsik.
Patch #3 restores q-in-q matching with nft_payload by reverting
f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support").
Patch #4 fixes vlan mangling in skbuff when vlan offload is present
in skbuff, without this patch nft_payload corrupts packets
in this case.
Patch #5 fixes possible nul-deref in tproxy no IP address is found in
netdevice, reported by syzbot and patch from Florian Westphal.
Patch #6 removes a superfluous restriction which prevents loose fib
lookups from input and forward hooks, from Eric Garver.
My assessment is that patches #1, #2 and #5 address possible kernel
crash, anything else in this batch fixes broken features.
Please, pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-24-05-23
Thanks.
----------------------------------------------------------------
The following changes since commit 4b377b4868ef17b040065bd468668c707d2477a5:
kprobe/ftrace: fix build error due to bad function definition (2024-05-17 19:17:55 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git tags/nf-24-05-23
for you to fetch changes up to ece92825a1fa31cf704a5898fd599daab5cb6573:
netfilter: nft_fib: allow from forward/input without iif selector (2024-05-23 17:56:31 +0200)
----------------------------------------------------------------
netfilter pull request 24-05-23
----------------------------------------------------------------
Alexander Maltsev (1):
netfilter: ipset: Add list flush to cancel_gc
Eric Dumazet (1):
netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
Eric Garver (1):
netfilter: nft_fib: allow from forward/input without iif selector
Florian Westphal (1):
netfilter: tproxy: bail out if IP has been disabled on the device
Pablo Neira Ayuso (2):
netfilter: nft_payload: restore vlan q-in-q match support
netfilter: nft_payload: skbuff vlan metadata mangle support
net/ipv4/netfilter/nf_tproxy_ipv4.c | 2 +
net/netfilter/ipset/ip_set_list_set.c | 3 ++
net/netfilter/nfnetlink_queue.c | 2 +
net/netfilter/nft_fib.c | 8 ++-
net/netfilter/nft_payload.c | 95 ++++++++++++++++++++++++++---------
5 files changed, 82 insertions(+), 28 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net 1/6] netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
@ 2024-05-23 16:20 ` Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 2/6] netfilter: ipset: Add list flush to cancel_gc Pablo Neira Ayuso
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-23 16:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
From: Eric Dumazet <edumazet@google.com>
syzbot reported that nf_reinject() could be called without rcu_read_lock() :
WARNING: suspicious RCU usage
6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0 Not tainted
net/netfilter/nfnetlink_queue.c:263 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
2 locks held by syz-executor.4/13427:
#0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline]
#0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2190 [inline]
#0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_core+0xa86/0x1830 kernel/rcu/tree.c:2471
#1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
#1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: nfqnl_flush net/netfilter/nfnetlink_queue.c:405 [inline]
#1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: instance_destroy_rcu+0x30/0x220 net/netfilter/nfnetlink_queue.c:172
stack backtrace:
CPU: 0 PID: 13427 Comm: syz-executor.4 Not tainted 6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
lockdep_rcu_suspicious+0x221/0x340 kernel/locking/lockdep.c:6712
nf_reinject net/netfilter/nfnetlink_queue.c:323 [inline]
nfqnl_reinject+0x6ec/0x1120 net/netfilter/nfnetlink_queue.c:397
nfqnl_flush net/netfilter/nfnetlink_queue.c:410 [inline]
instance_destroy_rcu+0x1ae/0x220 net/netfilter/nfnetlink_queue.c:172
rcu_do_batch kernel/rcu/tree.c:2196 [inline]
rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2471
handle_softirqs+0x2d6/0x990 kernel/softirq.c:554
__do_softirq kernel/softirq.c:588 [inline]
invoke_softirq kernel/softirq.c:428 [inline]
__irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043
</IRQ>
<TASK>
Fixes: 9872bec773c2 ("[NETFILTER]: nfnetlink: use RCU for queue instances hash")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nfnetlink_queue.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 00f4bd21c59b..f1c31757e496 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -169,7 +169,9 @@ instance_destroy_rcu(struct rcu_head *head)
struct nfqnl_instance *inst = container_of(head, struct nfqnl_instance,
rcu);
+ rcu_read_lock();
nfqnl_flush(inst, NULL, 0);
+ rcu_read_unlock();
kfree(inst);
module_put(THIS_MODULE);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 2/6] netfilter: ipset: Add list flush to cancel_gc
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 1/6] netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu() Pablo Neira Ayuso
@ 2024-05-23 16:20 ` Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 3/6] netfilter: nft_payload: restore vlan q-in-q match support Pablo Neira Ayuso
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-23 16:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
From: Alexander Maltsev <keltar.gw@gmail.com>
Flushing list in cancel_gc drops references to other lists right away,
without waiting for RCU to destroy list. Fixes race when referenced
ipsets can't be destroyed while referring list is scheduled for destroy.
Fixes: 97f7cf1cd80e ("netfilter: ipset: fix performance regression in swap operation")
Signed-off-by: Alexander Maltsev <keltar.gw@gmail.com>
Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/ipset/ip_set_list_set.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
index 6c3f28bc59b3..54e2a1dd7f5f 100644
--- a/net/netfilter/ipset/ip_set_list_set.c
+++ b/net/netfilter/ipset/ip_set_list_set.c
@@ -549,6 +549,9 @@ list_set_cancel_gc(struct ip_set *set)
if (SET_WITH_TIMEOUT(set))
timer_shutdown_sync(&map->gc);
+
+ /* Flush list to drop references to other ipsets */
+ list_set_flush(set);
}
static const struct ip_set_type_variant set_variant = {
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 3/6] netfilter: nft_payload: restore vlan q-in-q match support
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 1/6] netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu() Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 2/6] netfilter: ipset: Add list flush to cancel_gc Pablo Neira Ayuso
@ 2024-05-23 16:20 ` Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 4/6] netfilter: nft_payload: skbuff vlan metadata mangle support Pablo Neira Ayuso
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-23 16:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
Revert f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support").
f41f72d09ee1 ("netfilter: nft_payload: simplify vlan header handling")
already allows to match on inner vlan tags by subtract the vlan header
size to the payload offset which has been popped and stored in skbuff
metadata fields.
Fixes: f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nft_payload.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index 0a689c8e0295..a3cb5dbcb362 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -45,36 +45,27 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len)
int mac_off = skb_mac_header(skb) - skb->data;
u8 *vlanh, *dst_u8 = (u8 *) d;
struct vlan_ethhdr veth;
- u8 vlan_hlen = 0;
-
- if ((skb->protocol == htons(ETH_P_8021AD) ||
- skb->protocol == htons(ETH_P_8021Q)) &&
- offset >= VLAN_ETH_HLEN && offset < VLAN_ETH_HLEN + VLAN_HLEN)
- vlan_hlen += VLAN_HLEN;
vlanh = (u8 *) &veth;
- if (offset < VLAN_ETH_HLEN + vlan_hlen) {
+ if (offset < VLAN_ETH_HLEN) {
u8 ethlen = len;
- if (vlan_hlen &&
- skb_copy_bits(skb, mac_off, &veth, VLAN_ETH_HLEN) < 0)
- return false;
- else if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth))
+ if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth))
return false;
- if (offset + len > VLAN_ETH_HLEN + vlan_hlen)
- ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen;
+ if (offset + len > VLAN_ETH_HLEN)
+ ethlen -= offset + len - VLAN_ETH_HLEN;
- memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);
+ memcpy(dst_u8, vlanh + offset, ethlen);
len -= ethlen;
if (len == 0)
return true;
dst_u8 += ethlen;
- offset = ETH_HLEN + vlan_hlen;
+ offset = ETH_HLEN;
} else {
- offset -= VLAN_HLEN + vlan_hlen;
+ offset -= VLAN_HLEN;
}
return skb_copy_bits(skb, offset + mac_off, dst_u8, len) == 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 4/6] netfilter: nft_payload: skbuff vlan metadata mangle support
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
` (2 preceding siblings ...)
2024-05-23 16:20 ` [PATCH net 3/6] netfilter: nft_payload: restore vlan q-in-q match support Pablo Neira Ayuso
@ 2024-05-23 16:20 ` Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 5/6] netfilter: tproxy: bail out if IP has been disabled on the device Pablo Neira Ayuso
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-23 16:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
Userspace assumes vlan header is present at a given offset, but vlan
offload allows to store this in metadata fields of the skbuff. Hence
mangling vlan results in a garbled packet. Handle this transparently by
adding a parser to the kernel.
If vlan metadata is present and payload offset is over 12 bytes (source
and destination mac address fields), then subtract vlan header present
in vlan metadata, otherwise mangle vlan metadata based on offset and
length, extracting data from the source register.
This is similar to:
8cfd23e67401 ("netfilter: nft_payload: work around vlan header stripping")
to deal with vlan payload mangling.
Fixes: 7ec3f7b47b8d ("netfilter: nft_payload: add packet mangling support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nft_payload.c | 72 +++++++++++++++++++++++++++++++++----
1 file changed, 65 insertions(+), 7 deletions(-)
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index a3cb5dbcb362..f97ee7645bd2 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -145,12 +145,12 @@ int nft_payload_inner_offset(const struct nft_pktinfo *pkt)
return pkt->inneroff;
}
-static bool nft_payload_need_vlan_copy(const struct nft_payload *priv)
+static bool nft_payload_need_vlan_adjust(u32 offset, u32 len)
{
- unsigned int len = priv->offset + priv->len;
+ unsigned int boundary = offset + len;
/* data past ether src/dst requested, copy needed */
- if (len > offsetof(struct ethhdr, h_proto))
+ if (boundary > offsetof(struct ethhdr, h_proto))
return true;
return false;
@@ -174,7 +174,7 @@ void nft_payload_eval(const struct nft_expr *expr,
goto err;
if (skb_vlan_tag_present(skb) &&
- nft_payload_need_vlan_copy(priv)) {
+ nft_payload_need_vlan_adjust(priv->offset, priv->len)) {
if (!nft_payload_copy_vlan(dest, skb,
priv->offset, priv->len))
goto err;
@@ -801,21 +801,79 @@ struct nft_payload_set {
u8 csum_flags;
};
+/* This is not struct vlan_hdr. */
+struct nft_payload_vlan_hdr {
+ __be16 h_vlan_proto;
+ __be16 h_vlan_TCI;
+};
+
+static bool
+nft_payload_set_vlan(const u32 *src, struct sk_buff *skb, u8 offset, u8 len,
+ int *vlan_hlen)
+{
+ struct nft_payload_vlan_hdr *vlanh;
+ __be16 vlan_proto;
+ u16 vlan_tci;
+
+ if (offset >= offsetof(struct vlan_ethhdr, h_vlan_encapsulated_proto)) {
+ *vlan_hlen = VLAN_HLEN;
+ return true;
+ }
+
+ switch (offset) {
+ case offsetof(struct vlan_ethhdr, h_vlan_proto):
+ if (len == 2) {
+ vlan_proto = nft_reg_load_be16(src);
+ skb->vlan_proto = vlan_proto;
+ } else if (len == 4) {
+ vlanh = (struct nft_payload_vlan_hdr *)src;
+ __vlan_hwaccel_put_tag(skb, vlanh->h_vlan_proto,
+ ntohs(vlanh->h_vlan_TCI));
+ } else {
+ return false;
+ }
+ break;
+ case offsetof(struct vlan_ethhdr, h_vlan_TCI):
+ if (len != 2)
+ return false;
+
+ vlan_tci = ntohs(nft_reg_load_be16(src));
+ skb->vlan_tci = vlan_tci;
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
static void nft_payload_set_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt)
{
const struct nft_payload_set *priv = nft_expr_priv(expr);
- struct sk_buff *skb = pkt->skb;
const u32 *src = ®s->data[priv->sreg];
- int offset, csum_offset;
+ int offset, csum_offset, vlan_hlen = 0;
+ struct sk_buff *skb = pkt->skb;
__wsum fsum, tsum;
switch (priv->base) {
case NFT_PAYLOAD_LL_HEADER:
if (!skb_mac_header_was_set(skb))
goto err;
- offset = skb_mac_header(skb) - skb->data;
+
+ if (skb_vlan_tag_present(skb) &&
+ nft_payload_need_vlan_adjust(priv->offset, priv->len)) {
+ if (!nft_payload_set_vlan(src, skb,
+ priv->offset, priv->len,
+ &vlan_hlen))
+ goto err;
+
+ if (!vlan_hlen)
+ return;
+ }
+
+ offset = skb_mac_header(skb) - skb->data - vlan_hlen;
break;
case NFT_PAYLOAD_NETWORK_HEADER:
offset = skb_network_offset(skb);
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 5/6] netfilter: tproxy: bail out if IP has been disabled on the device
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
` (3 preceding siblings ...)
2024-05-23 16:20 ` [PATCH net 4/6] netfilter: nft_payload: skbuff vlan metadata mangle support Pablo Neira Ayuso
@ 2024-05-23 16:20 ` Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 6/6] netfilter: nft_fib: allow from forward/input without iif selector Pablo Neira Ayuso
2024-05-25 21:29 ` [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
6 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-23 16:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
From: Florian Westphal <fw@strlen.de>
syzbot reports:
general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
[..]
RIP: 0010:nf_tproxy_laddr4+0xb7/0x340 net/ipv4/netfilter/nf_tproxy_ipv4.c:62
Call Trace:
nft_tproxy_eval_v4 net/netfilter/nft_tproxy.c:56 [inline]
nft_tproxy_eval+0xa9a/0x1a00 net/netfilter/nft_tproxy.c:168
__in_dev_get_rcu() can return NULL, so check for this.
Reported-and-tested-by: syzbot+b94a6818504ea90d7661@syzkaller.appspotmail.com
Fixes: cc6eb4338569 ("tproxy: use the interface primary IP address as a default value for --on-ip")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter/nf_tproxy_ipv4.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/netfilter/nf_tproxy_ipv4.c b/net/ipv4/netfilter/nf_tproxy_ipv4.c
index 69e331799604..73e66a088e25 100644
--- a/net/ipv4/netfilter/nf_tproxy_ipv4.c
+++ b/net/ipv4/netfilter/nf_tproxy_ipv4.c
@@ -58,6 +58,8 @@ __be32 nf_tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr)
laddr = 0;
indev = __in_dev_get_rcu(skb->dev);
+ if (!indev)
+ return daddr;
in_dev_for_each_ifa_rcu(ifa, indev) {
if (ifa->ifa_flags & IFA_F_SECONDARY)
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 6/6] netfilter: nft_fib: allow from forward/input without iif selector
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
` (4 preceding siblings ...)
2024-05-23 16:20 ` [PATCH net 5/6] netfilter: tproxy: bail out if IP has been disabled on the device Pablo Neira Ayuso
@ 2024-05-23 16:20 ` Pablo Neira Ayuso
2024-05-25 21:29 ` [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
6 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-23 16:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
From: Eric Garver <eric@garver.life>
This removes the restriction of needing iif selector in the
forward/input hooks for fib lookups when requested result is
oif/oifname.
Removing this restriction allows "loose" lookups from the forward hooks.
Fixes: be8be04e5ddb ("netfilter: nft_fib: reverse path filter for policy-based routing on iif")
Signed-off-by: Eric Garver <eric@garver.life>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nft_fib.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/netfilter/nft_fib.c b/net/netfilter/nft_fib.c
index 37cfe6dd712d..b58f62195ff3 100644
--- a/net/netfilter/nft_fib.c
+++ b/net/netfilter/nft_fib.c
@@ -35,11 +35,9 @@ int nft_fib_validate(const struct nft_ctx *ctx, const struct nft_expr *expr,
switch (priv->result) {
case NFT_FIB_RESULT_OIF:
case NFT_FIB_RESULT_OIFNAME:
- hooks = (1 << NF_INET_PRE_ROUTING);
- if (priv->flags & NFTA_FIB_F_IIF) {
- hooks |= (1 << NF_INET_LOCAL_IN) |
- (1 << NF_INET_FORWARD);
- }
+ hooks = (1 << NF_INET_PRE_ROUTING) |
+ (1 << NF_INET_LOCAL_IN) |
+ (1 << NF_INET_FORWARD);
break;
case NFT_FIB_RESULT_ADDRTYPE:
if (priv->flags & NFTA_FIB_F_IIF)
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH net 0/6,v2] Netfilter fixes for net
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
` (5 preceding siblings ...)
2024-05-23 16:20 ` [PATCH net 6/6] netfilter: nft_fib: allow from forward/input without iif selector Pablo Neira Ayuso
@ 2024-05-25 21:29 ` Pablo Neira Ayuso
2024-05-27 9:59 ` Paolo Abeni
6 siblings, 1 reply; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-25 21:29 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba, pabeni, edumazet, fw
Hi,
On Thu, May 23, 2024 at 06:20:13PM +0200, Pablo Neira Ayuso wrote:
> v2: fixes sparse warnings due to incorrect endianness in vlan mangling fix
> reported by kbuild robot and Paolo Abeni.
I realized checkpatch complains on use of spaces instead of
indentation in patch 4/6.
I can repost the series as v3. Apologies for this comestic issue.
Thanks.
> -o-
>
> Hi,
>
> The following patchset contains Netfilter fixes for net:
>
> Patch #1 syzbot reports that nf_reinject() could be called without
> rcu_read_lock() when flushing pending packets at nfnetlink
> queue removal, from Eric Dumazet.
>
> Patch #2 flushes ipset list:set when canceling garbage collection to
> reference to other lists to fix a race, from Jozsef Kadlecsik.
>
> Patch #3 restores q-in-q matching with nft_payload by reverting
> f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support").
>
> Patch #4 fixes vlan mangling in skbuff when vlan offload is present
> in skbuff, without this patch nft_payload corrupts packets
> in this case.
>
> Patch #5 fixes possible nul-deref in tproxy no IP address is found in
> netdevice, reported by syzbot and patch from Florian Westphal.
>
> Patch #6 removes a superfluous restriction which prevents loose fib
> lookups from input and forward hooks, from Eric Garver.
>
> My assessment is that patches #1, #2 and #5 address possible kernel
> crash, anything else in this batch fixes broken features.
>
> Please, pull these changes from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-24-05-23
>
> Thanks.
>
> ----------------------------------------------------------------
>
> The following changes since commit 4b377b4868ef17b040065bd468668c707d2477a5:
>
> kprobe/ftrace: fix build error due to bad function definition (2024-05-17 19:17:55 -0700)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git tags/nf-24-05-23
>
> for you to fetch changes up to ece92825a1fa31cf704a5898fd599daab5cb6573:
>
> netfilter: nft_fib: allow from forward/input without iif selector (2024-05-23 17:56:31 +0200)
>
> ----------------------------------------------------------------
> netfilter pull request 24-05-23
>
> ----------------------------------------------------------------
> Alexander Maltsev (1):
> netfilter: ipset: Add list flush to cancel_gc
>
> Eric Dumazet (1):
> netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
>
> Eric Garver (1):
> netfilter: nft_fib: allow from forward/input without iif selector
>
> Florian Westphal (1):
> netfilter: tproxy: bail out if IP has been disabled on the device
>
> Pablo Neira Ayuso (2):
> netfilter: nft_payload: restore vlan q-in-q match support
> netfilter: nft_payload: skbuff vlan metadata mangle support
>
> net/ipv4/netfilter/nf_tproxy_ipv4.c | 2 +
> net/netfilter/ipset/ip_set_list_set.c | 3 ++
> net/netfilter/nfnetlink_queue.c | 2 +
> net/netfilter/nft_fib.c | 8 ++-
> net/netfilter/nft_payload.c | 95 ++++++++++++++++++++++++++---------
> 5 files changed, 82 insertions(+), 28 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net 0/6,v2] Netfilter fixes for net
2024-05-25 21:29 ` [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
@ 2024-05-27 9:59 ` Paolo Abeni
2024-05-27 10:12 ` Paolo Abeni
0 siblings, 1 reply; 11+ messages in thread
From: Paolo Abeni @ 2024-05-27 9:59 UTC (permalink / raw)
To: Pablo Neira Ayuso, netfilter-devel; +Cc: davem, netdev, kuba, edumazet, fw
On Sat, 2024-05-25 at 23:29 +0200, Pablo Neira Ayuso wrote:
> Hi,
>
> On Thu, May 23, 2024 at 06:20:13PM +0200, Pablo Neira Ayuso wrote:
> > v2: fixes sparse warnings due to incorrect endianness in vlan mangling fix
> > reported by kbuild robot and Paolo Abeni.
>
> I realized checkpatch complains on use of spaces instead of
> indentation in patch 4/6.
>
> I can repost the series as v3. Apologies for this comestic issue.
I think the overhead of a repost would offset the benefit of cleaning-
up that minor format issue.
You could follow-up on net-next if/as needed.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net 0/6,v2] Netfilter fixes for net
2024-05-27 9:59 ` Paolo Abeni
@ 2024-05-27 10:12 ` Paolo Abeni
2024-05-27 14:56 ` Pablo Neira Ayuso
0 siblings, 1 reply; 11+ messages in thread
From: Paolo Abeni @ 2024-05-27 10:12 UTC (permalink / raw)
To: Pablo Neira Ayuso, netfilter-devel; +Cc: davem, netdev, kuba, edumazet, fw
On Mon, 2024-05-27 at 11:59 +0200, Paolo Abeni wrote:
> On Sat, 2024-05-25 at 23:29 +0200, Pablo Neira Ayuso wrote:
> > Hi,
> >
> > On Thu, May 23, 2024 at 06:20:13PM +0200, Pablo Neira Ayuso wrote:
> > > v2: fixes sparse warnings due to incorrect endianness in vlan mangling fix
> > > reported by kbuild robot and Paolo Abeni.
> >
> > I realized checkpatch complains on use of spaces instead of
> > indentation in patch 4/6.
> >
> > I can repost the series as v3. Apologies for this comestic issue.
>
> I think the overhead of a repost would offset the benefit of cleaning-
> up that minor format issue.
I'm sorry for being so self-contradictory in a very short period of
time, but before I misread the report.
I think this specific format violation is worth fixing. Could you
please send a v3?
Thanks!
Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net 0/6,v2] Netfilter fixes for net
2024-05-27 10:12 ` Paolo Abeni
@ 2024-05-27 14:56 ` Pablo Neira Ayuso
0 siblings, 0 replies; 11+ messages in thread
From: Pablo Neira Ayuso @ 2024-05-27 14:56 UTC (permalink / raw)
To: Paolo Abeni; +Cc: netfilter-devel, davem, netdev, kuba, edumazet, fw
On Mon, May 27, 2024 at 12:12:39PM +0200, Paolo Abeni wrote:
> On Mon, 2024-05-27 at 11:59 +0200, Paolo Abeni wrote:
> > On Sat, 2024-05-25 at 23:29 +0200, Pablo Neira Ayuso wrote:
> > > Hi,
> > >
> > > On Thu, May 23, 2024 at 06:20:13PM +0200, Pablo Neira Ayuso wrote:
> > > > v2: fixes sparse warnings due to incorrect endianness in vlan mangling fix
> > > > reported by kbuild robot and Paolo Abeni.
> > >
> > > I realized checkpatch complains on use of spaces instead of
> > > indentation in patch 4/6.
> > >
> > > I can repost the series as v3. Apologies for this comestic issue.
> >
> > I think the overhead of a repost would offset the benefit of cleaning-
> > up that minor format issue.
>
> I'm sorry for being so self-contradictory in a very short period of
> time, but before I misread the report.
>
> I think this specific format violation is worth fixing. Could you
> please send a v3?
Sure, preparing a v3. Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-05-27 14:57 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 16:20 [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 1/6] netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu() Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 2/6] netfilter: ipset: Add list flush to cancel_gc Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 3/6] netfilter: nft_payload: restore vlan q-in-q match support Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 4/6] netfilter: nft_payload: skbuff vlan metadata mangle support Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 5/6] netfilter: tproxy: bail out if IP has been disabled on the device Pablo Neira Ayuso
2024-05-23 16:20 ` [PATCH net 6/6] netfilter: nft_fib: allow from forward/input without iif selector Pablo Neira Ayuso
2024-05-25 21:29 ` [PATCH net 0/6,v2] Netfilter fixes for net Pablo Neira Ayuso
2024-05-27 9:59 ` Paolo Abeni
2024-05-27 10:12 ` Paolo Abeni
2024-05-27 14:56 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).