From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next] netfilter: nfnetlink_log: collapse both dev log blocks
Date: Fri, 2 Oct 2026 19:38:58 +0200 [thread overview]
Message-ID: <ar_sMnP4kaqmdIeS@strlen.de> (raw)
In-Reply-To: <20261002124132.13387-1-fw@strlen.de>
Florian Westphal <fw@strlen.de> wrote:
> Looked like this:
>
> if (indev && skb->dev &&
> skb_mac_header_was_set(skb) &&
> skb_mac_header_len(skb) != 0) {
> ...
> }
>
> if (indev && skb_mac_header_was_set(skb)) {
> ...
> }
>
> LLM (sashiko) claims there is a NULL deref in the second block, because
> it dereferences skb->dev without checking skb->dev != NULL.
>
> Don't know if `indev && !skb->dev` is even possible:
> NF_HOOK() invocation normally passes skb->dev as the indev argument.
>
> Instead of cargo-culting additional skb->dev check, lets just merge
> both blocks into one. This gives 2nd block the tighter guards and
> results in a small behavioral change:
>
> When `skb_mac_header_was_set` is true but `skb_mac_header_len == 0`
> HWADDR was not emitted, but HWTYPE/HWLEN was. But given 2nd block also
> emits NFULA_HWHEADER based off skb->dev->hard_header_len, that change
> is probably desireable.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
AI review doesn't like this, but I'm not so sure about the comment.
https://sashiko.dev/#/patchset/20261002124132.13387-1-fw%40strlen.de
NFULA_HWADDR (and related) are not univerally available even today,
their presence depends on hook/location that invoked nfnl logger.
NFULA_HWHEADER would even contain the l3 header in the LLM-presented
case. So I think this patch is fine as-is.
prev parent reply other threads:[~2026-10-02 17:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 12:41 [PATCH nf-next] netfilter: nfnetlink_log: collapse both dev log blocks Florian Westphal
2026-10-02 17:38 ` Florian Westphal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ar_sMnP4kaqmdIeS@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.