Re: [PATCH net] tipc: free the tunnel packets when failover tunnelling stops early
From: Andrew Stellman
Date: Mon Nov 23 2026 - 19:14:56 EST
Agreed: that return also skips the FAILOVER_MSG hand-over, and goto
out is safe there since tnlq is already initialised and empty. I'll
include it in v2.
pw-bot: cr
On Mon, Nov 23, 2026 at 7:03 PM <netdev-bot+sashiko@xxxxxxxxxx> wrote:
>
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] The patch leaves one early exit in tipc_link_tnl_prepare()
> (net/tipc/link.c) that still skips the FAILOVER_MSG receive-side hand-…
>
> --
>
> tipc: free the tunnel packets when failover tunnelling stops early
>
> The three early returns inside the tunnelling loop of
> tipc_link_tnl_prepare() now jump to a new out: label. That label purges
> any tunnel packets left on tnlq. It then runs the FAILOVER_MSG receive
> side hand-over (drop_point, failover_reasm_skb, deferdq).
>
> > diff --git a/net/tipc/link.c b/net/tipc/link.c
> > index 6427c69f89294..2fead2f4ed0fa 100644
> > --- a/net/tipc/link.c
> > +++ b/net/tipc/link.c
>
> [ ... ]
>
> > @@ -2073,6 +2073,9 @@ void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
> > }
> >
> > tipc_link_xmit(tnl, &tnlq, xmitq);
> > +out:
> > + /* Empty unless tunnelling stopped early */
> > + __skb_queue_purge(&tnlq);
> >
> > if (mtyp == FAILOVER_MSG) {
> > struct sk_buff_head *fdefq = &tnl->failover_deferdq;
>
> [Severity: Medium]
> The commit message says the fix is to "go on with the hand-over" when
> tunnelling stops early. Should the earlier exit, taken when the dummy
> packet can't be allocated, also jump to out?
>
> That path in tipc_link_tnl_prepare() still returns directly:
>
> net/tipc/link.c:tipc_link_tnl_prepare() {
> ...
> skb = tipc_msg_create(TIPC_LOW_IMPORTANCE, TIPC_DIRECT_MSG,
> BASIC_H_SIZE, 0, l->addr, tipc_own_addr(l->net),
> 0, 0, TIPC_ERR_NO_PORT);
> if (!skb) {
> pr_warn("%sunable to create tunnel packet\n", link_co_err);
> return;
> }
> ...
> }
>
> tipc_msg_create() allocates with tipc_buf_acquire(..., GFP_ATOMIC), so it
> can fail under memory pressure. If it fails for FAILOVER_MSG, this code
> never runs:
>
> tnl->drop_point = l->rcv_nxt;
> tnl->failover_reasm_skb = l->reasm_buf;
> skb_queue_splice_init(&l->deferdq, fdefq);
>
> The caller goes into failover anyway:
>
> __tipc_node_link_down()
> tipc_link_tnl_prepare(l, tnl, FAILOVER_MSG, xmitq);
> tipc_link_reset(l); <- frees l->reasm_buf, purges l->deferdq
> tipc_link_fsm_evt(l, LINK_RESET_EVT);
> tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT);
> tipc_node_fsm_evt(n, NODE_FAILOVER_BEGIN_EVT);
>
> tnl->drop_point then keeps a stale value. That is 0 from link creation,
> 1 from tipc_link_failover_prepare(), or whatever an earlier failover left.
> tipc_link_failover_rcv() then does this:
>
> if (unlikely(less(seqno, l->drop_point))) {
> kfree_skb(iskb);
> continue;
> }
> if (unlikely(seqno != l->drop_point)) {
> __tipc_skb_queue_sorted(fdefq, seqno, iskb);
> continue;
> }
>
> Could this drop the peer's tunnelled messages? Could it also leave them
> in failover_deferdq for good, since drop_point only moves forward on an
> exact match?
>
> tnlq is already initialised and empty at that point, and the out: block
> only touches tnlq, l and tnl. So changing that return to goto out looks
> safe.
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122233958.10462-1-astellman%40stellman-greene.com