Subject: Re: [PATCH net] sctp: fix ICMP processing if skb is non-linear

From: Davide Caratti <[email-masked]>
Date: Mon, 22 May 2017 18:09:16 +0200

hello Xin Long,
On Sat, 2017-05-20 at 02:40 +0800, Xin Long wrote:
> On Fri, May 19, 2017 at 11:34 PM, Davide Caratti <[email-masked]> wrote:
> > @@ -515,14 +515,23 @@ struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *skb,
> >          * or the chunk type or the Initiate Tag does not match, silently
> >          * discard the packet.
> >          */
> > +       offset = skb_transport_offset(skb);
> > +       sctphdr = skb_header_pointer(skb, offset, sizeof(_sctphdr), &_sctphdr);
> > +       if (unlikely(!sctphdr))
> > +               goto out;
> > +
> > +       vtag = ntohl(sctphdr->vtag);
> >         if (vtag == 0) {
> > -               chunkhdr = (void *)sctphdr + sizeof(struct sctphdr);
> > -               if (len < sizeof(struct sctphdr) + sizeof(sctp_chunkhdr_t)
> > -                         + sizeof(__be32) ||
> > +               offset += sizeof(_sctphdr);
> 
> will be nice to delete this line, and use
> > +               /* chunk header + first 4 octects of init header */
> > +               chunkhdr = skb_header_pointer(skb, offset,
> 
> chunkhdr = skb_header_pointer(skb, offset + sizeof(_sctphdr), ;)
> wdyt?

that's right, 'offset' does not need the re-assignment: I will post the v2
soon. Thanks!