From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH V2 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers
Date: Mon, 17 Oct 2016 15:18:04 -0400 [thread overview]
Message-ID: <20161017191804.GE15976@oracle.com> (raw)
In-Reply-To: <CAKgT0Uee88Vh8aHDDzMBZojGjkEz_Po5AKq+6yJ2tVambzH8zw@mail.gmail.com>
On (10/17/16 11:15), Alexander Duyck wrote:
> I would say you probably only need the first check here for skb->data
> and could probably skip the second part. You will be testing for
> skb_tail_pointer in all the other tests you added so this check is
> redundant anyway.
>
> Also you might want to go through and wrap these with unlikely() since
> most of these are exception cases.
Ok.. v3 will have this.
> > /* Currently only IPv4/IPv6 with TCP is supported */
> > switch (hdr.ipv4->version) {
> > case IPVERSION:
> > /* access ihl as u8 to avoid unaligned access on ia64 */
> > hlen = (hdr.network[0] & 0x0F) << 2;
> > + if (skb_tail_pointer(skb) < hdr.network + hlen +
> > + sizeof(struct tcphdr))
> > + return;
> > l4_proto = hdr.ipv4->protocol;
> > break;
> > case 6:
> > hlen = hdr.network - skb->data;
> > + if (skb_tail_pointer(skb) < hdr.network + hlen +
> > + sizeof(struct tcphdr))
> > + return;
> > l4_proto = ipv6_find_hdr(skb, &hlen, IPPROTO_TCP, NULL, NULL);
> > hlen -= hdr.network - skb->data;
> > break;
>
> I believe one more check is needed after this block to verify the TCP
> header fields are present.
>
> So you probably need to add a check for "skb_tail_pointer(skb) <
> (hdr.network + hlen + 20)".
But isnt that the same thing as the checks before l4_proto computation above?
--Sowmini
next prev parent reply other threads:[~2016-10-17 19:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 17:25 [Intel-wired-lan] [PATCH V2 RFC 0/2] ixgbe: ixgbe_atr() bug fixes Sowmini Varadhan
2016-10-17 17:25 ` [Intel-wired-lan] [PATCH V2 RFC 1/2] ixgbe: ixgbe_atr() should access udp_hdr(skb) only for UDP packets Sowmini Varadhan
2016-10-17 17:25 ` [Intel-wired-lan] [PATCH V2 RFC 2/2] ixgbe: ixgbe_atr() compute l4_proto only if non-paged data has network/transport headers Sowmini Varadhan
2016-10-17 18:15 ` Alexander Duyck
2016-10-17 19:18 ` Sowmini Varadhan [this message]
2016-10-17 19:49 ` Alexander Duyck
2016-10-17 21:16 ` Sowmini Varadhan
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=20161017191804.GE15976@oracle.com \
--to=sowmini.varadhan@oracle.com \
--cc=intel-wired-lan@osuosl.org \
/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