Re: [PATCH net] seg6: ensure packet data is writable before modifying SRH and IPv6 DA

From: Hangbin Liu

Date: Tue Sep 29 2026 - 20:44:56 EST


On Wed, Sep 30, 2026 at 01:39:10AM +0200, Andrea Mayer wrote:
> On Tue, 29 Sep 2026 11:05:02 +0800
> Hangbin Liu <hangbin.liu@xxxxxxxxx> wrote:
>
> > [snip]
> >
> > > static int input_action_end_core(struct sk_buff *skb,
> > > struct seg6_local_lwt *slwt)
> > > {
> > > + enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;
> > > struct ipv6_sr_hdr *srh;
> > > + int err = -EINVAL;
> > >
> > > srh = get_and_validate_srh(skb);
> > > if (!srh)
> > > goto drop;
> > >
> > > - advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
> > > + srh = advance_nextseg(skb, srh, &reason);
> > > + if (!srh) {
> > > + err = -ENOMEM;
> > > + goto drop;
> > > + }
> >
> > The srh is not used in the later function, maybe just
> >
> > if (!advance_nextseg(skb, srh, &reason)) {
> > err = -ENOMEM;
> > goto drop;
> > }
> >
> > [snip]
>
> Hi Hangbin,
>
> Right. Since the patch changed advance_nextseg() to return the SRH,
> I updated srh at every call site. Your form works as well where srh
> is not used afterwards.

Never mind. I replied to your patch too late. It has been merged into net.

Thanks
Hangin