[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1386005257.1516.20.camel@bwh-desktop.uk.level5networks.com>
Date: Mon, 2 Dec 2013 17:27:37 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Paul Durrant <Paul.Durrant@...rix.com>
CC: David Miller <davem@...emloft.net>,
"xen-devel@...ts.xen.org" <xen-devel@...ts.xen.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Wei Liu <wei.liu2@...rix.com>,
Ian Campbell <Ian.Campbell@...rix.com>,
David Vrabel <david.vrabel@...rix.com>
Subject: Re: [PATCH net v3] xen-netback: fix fragment detection in checksum
setup
On Mon, 2013-12-02 at 09:45 +0000, Paul Durrant wrote:
> > -----Original Message-----
> > From: David Miller [mailto:davem@...emloft.net]
> > Sent: 30 November 2013 21:14
> > To: Paul Durrant
> > Cc: xen-devel@...ts.xen.org; netdev@...r.kernel.org; Wei Liu; Ian Campbell;
> > David Vrabel
> > Subject: Re: [PATCH net v3] xen-netback: fix fragment detection in checksum
> > setup
> >
> > From: Paul Durrant <paul.durrant@...rix.com>
> > Date: Fri, 29 Nov 2013 10:52:08 +0000
> >
> > > @@ -1166,15 +1166,27 @@ static int checksum_setup_ip(struct xenvif *vif,
> > struct sk_buff *skb,
> > > struct iphdr *iph = (void *)skb->data;
> > > unsigned int header_size;
> > > unsigned int off;
> > > + bool fragment;
> > > int err = -EPROTO;
> > >
> > > + fragment = false;
> > > +
> > > off = sizeof(struct iphdr);
> > >
> > > header_size = skb->network_header + off + MAX_IPOPTLEN;
> > > maybe_pull_tail(skb, header_size);
> > >
> > > + if (iph->frag_off & htons(IP_OFFSET | IP_MF))
> > > + fragment = true;
> >
> > This function has a serious problem.
> >
> > maybe_pull_tail() can change skb->data, therefore this "iph" pointer
> > can become invalid, you're essentially dereferencing garbage if
> > maybe_pull_tail() actually does any work.
>
> Ok. Clearly I'm misunderstanding what __pskb_pull_tail() does then. I
> was under the impression that it moved skb->tail on but left skb->data
> alone (which is what I want to do). I will have another look.
[...]
A pull does not change the offset of skb->data but it may need to
expand, i.e. reallocate, the skb head area. The kernel-doc states
clearly that this can happen.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists