BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jamal Hadi Salim" <jhs@mojatatu.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v6 2/3] net: neighbour: reinject a parked skb through a headerless output device
Date: Fri, 20 Nov 2026 12:40:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-225153@kernel.org> (raw)
In-Reply-To: <QDISC-6HS9.v6.r0.20261119070330-2@mojatatu.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: neighbour: reinjecting skb onto n1->dev misroutes
  redirected packets
--

commit dce8515be5271f5a3b9c463a37e73a62aef0f6af
Author: Jamal Hadi Salim <jhs@mojatatu.com>

net: neighbour: reinject a parked skb through a headerless output device

This commit restores skb->dev to n1->dev in neigh_update_process_arp_queue()
when n1->dev has no header_ops before calling n1->output().

Link: https://lore.kernel.org/netdev/20261110101908.2e64e8e9@kernel.org/

> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index ae2db3912454a..d36d86cfc441c 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -1342,6 +1342,9 @@ static void neigh_update_process_arp_queue(struct neighbour *neigh)
>  			if (n2)
>  				n1 = n2;
>  		}
> +		/* headerless output transmits on skb->dev, not n1->dev */
> +		if (!n1->dev->header_ops)
> +			skb->dev = n1->dev;
>  		READ_ONCE(n1->output)(n1, skb);

[Severity: Medium]
Can setting skb->dev = n1->dev misroute packets that were steered to another
device while retaining a dst pointing to a headerless device?

As the commit message notes, nft_fwd_neigh_eval() and
__bpf_redirect_neigh_v4() / __bpf_redirect_neigh_v6() (when nh is provided)
steer the packet to a target device and nexthop while leaving the original
skb_dst(skb) attached, and neither site drops that dst in this tree.  When a
packet originally routed to a headerless device is redirected to an
unresolved neighbour on another device, neigh_update_process_arp_queue()
re-looks up n1 from the retained dst, resets skb->dev to the original
headerless device, and transmits the packet there instead of on the target
device (or re-runs n1->dev's egress hook and decrements TTL a second time if
redirected from NF_NETDEV_EGRESS).

An egress redirect or mirror via tcf_mirred_to_dev() from a headerless
device to teql0 hits the same issue, and cannot drop skb_dst(skb) because
teql_resolve() requires the dst to resolve the slave neighbour.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/QDISC-6HS9.v6.r0.20261119070330@mojatatu.com?part=2

      reply	other threads:[~2026-11-20 12:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 12:40 [PATCH net v6 0/3] net/sched: sch_teql: keep the transmit path's skb geometry and device lifetime intact Jamal Hadi Salim
2026-11-19 12:40 ` [PATCH net v6 2/3] net: neighbour: reinject a parked skb through a headerless output device Jamal Hadi Salim
2026-11-20 12:40   ` sashiko-bot [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=sashiko-outbox-225153@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox