Re: [PATCH] netfilter: nfnetlink_log: fix config error handling, SIT headroom OOB read, and nlmsg rollback

From: Florian Westphal

Date: Mon Nov 16 2026 - 14:15:43 EST


Hui Peng <benquike@xxxxxxxxx> wrote:
> Fix three issues in net/netfilter/nfnetlink_log.c:
>
> 1. In __build_packet_message(), subtracting ETH_HLEN from skb_mac_header()
> for ARPHRD_SIT tunnels can read before skb->head or past
> skb_tail_pointer(skb), and nla_put_failure returns -1 without calling
> nlmsg_cancel(inst->skb, nlh). Remove the unsafe ETH_HLEN subtraction,

That made no sense to me. The entire ARPHRD_SIT check is dead code
nowadays and it will be removed in -next.

But how is it 'unsafe'? If it moves to before skb->head, no read will
occur.

> verify hwhdrp + hard_header_len <= skb_tail_pointer(skb), and cancel
> the partial nlmsg on error.

I don't think its expected to ever fail. There is a space-remaining
check *before* __build_packet_message() is called.

> 2. In nfulnl_log_packet(), only increment inst->qlen after
> __build_packet_message() succeeds.

See above.

> 3. In nfulnl_recv_config(), propagate errors from nfulnl_set_mode() and
> nfulnl_set_nlbufsiz() and destroy the newly created instance if
> NFULNL_CFG_CMD_BIND was processed in the same message.

Not sure about this. Could cause existing (working!) userspace
to fail.

> Fixes: 0c36b48b36dc ("netfilter: nfnetlink_log: fix mac address for 6in4 tunnels")

Not really. Most of these 'fixes' are day-0 bugs.

I suggest we wait for the ARPHRD_SIT removal series to land in nf-next.

Then at least some of the changes here could land as cleanups.