Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] In nf_ct_bridge_pre() (net/bridge/netfilter/nf_conntrack_bridge.c), the patch changes the… -- netfilter: bridge: detach conntrack template on invalid IP frames This makes nf_ct_bridge_pre() jump to a shared error path when the IPv4 or IPv6 header pull or validation checks fail. That path calls nf_reset_ct(), so a conntrack template attached by an earlier bridge rule is released and the frame is treated as ct state invalid. The patch also changes a failed pskb_trim_rcsum() to return NF_DROP instead of NF_ACCEPT. Closes: https://sashiko.dev/#/patchset/3cf1…@nebusec.ai
> diff --git a/net/bridge/netfilter/nf_conntrack_bridge.c b/net/bridge/netfilter/nf_conntrack_bridge.c > index 8c83dc05114ba..aa1e01213e842 100644 > --- a/net/bridge/netfilter/nf_conntrack_bridge.c > +++ b/net/bridge/netfilter/nf_conntrack_bridge.c > @@ -257,28 +257,28 @@ static unsigned int nf_ct_bridge_pre(void *priv, struct sk_buff *skb, > switch (skb->protocol) { > case htons(ETH_P_IP): > if (!pskb_may_pull(skb, sizeof(struct iphdr))) > - return NF_ACCEPT; > + goto invalid; > > len = skb_ip_totlen(skb); > if (pskb_trim_rcsum(skb, len)) > - return NF_ACCEPT; > + return NF_DROP;
[Severity: Low] The commit message says: [ While at it, drop packet if pskb_trim_rcsum() fails, when memory is exhausted. --pablo ] Is memory exhaustion the only way this call can fail? For a CHECKSUM_PARTIAL skb, pskb_trim_rcsum_slow() can return -EINVAL without allocating anything: net/core/skbuff.c:pskb_trim_rcsum_slow() { ... } else if (skb->ip_summed == CHECKSUM_PARTIAL) { int hdlen = (len > skb_headlen(skb)) ? skb_headlen(skb) : len; int offset = skb_checksum_start_offset(skb) + skb->csum_offset; if (offset + sizeof(__sum16) > hdlen) return -EINVAL; } ... } pskb_trim_rcsum_complete() can also return -EFAULT. This happens for CHECKSUM_COMPLETE skbs with unreadable frags when len > skb_headlen(skb). Both failures come from packet contents and layout, not from memory pressure. Here, len comes straight from the unvalidated iph->tot_len, or from payload_len on the IPv6 path. nf_ct_br_ip_check() and nf_ct_br_ipv6_check() have not checked it yet. So can the same malformed header now get a different verdict depending on skb->ip_summed? Take a bridged non-GSO IPv4 frame whose tot_len is smaller than ihl * 4: CHECKSUM_PARTIAL: pskb_trim_rcsum() -> pskb_trim_rcsum_slow() returns -EINVAL -> NF_DROP CHECKSUM_NONE / CHECKSUM_UNNECESSARY: pskb_trim_rcsum() succeeds nf_ct_br_ip_check() fails -> goto invalid -> nf_reset_ct(), NF_ACCEPT A tap or veth sender can produce such CHECKSUM_PARTIAL frames by using a virtio_net_hdr with NEEDS_CSUM. The IPv6 trim path has the same ordering. The commit body also says the shared error path covers "all IPv4 and IPv6 header/length rejection paths". The two trim-failure paths don't take it. With Cc: stable, frames in these cases that used to be bridged are now dropped. Dropping on trim failure matches ip_rcv_core() and br_validate_ipv4(). Both drop on any pskb_trim_rcsum() failure, so well-formed traffic should not be affected. Could the note be updated to cover these non-ENOMEM failures? Another option would be to run the header/length checks before the trim. Then every malformed header reaches the invalid label, and NF_DROP is kept for real trim failures.
> > if (nf_ct_br_ip_check(skb)) > - return NF_ACCEPT; > + goto invalid;
[ ... ]
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40netfilter.org