From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets
Date: Mon, 14 Mar 2016 13:46:24 -0400 [thread overview]
Message-ID: <20160314174624.GG5084@oracle.com> (raw)
For LLC based protocols like lldp, stp etc., the ethernet header
is an 802.3 header with a h_proto that is not 0x800, 0x86dd, or
even 0x806. In this world, the skb_network_header() points at
the DSAP/SSAP/.. and is not likely to be NET_IP_ALIGNed in
ixgbe_atr().
With LLC, drivers are not likely to correctly find IPVERSION,
or "6", at hdr.ipv4->version, but will instead just needlessly
trigger an unaligned access. (IPv4/IPv6 over LLC is almost never
implemented).
The unaligned access is thus avoidable: bail out quickly after
examining first->protocol.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
v2: Alexander Duyck comments.
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4d6223d..b25e603 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7574,6 +7574,11 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
if (!ring->atr_sample_rate)
return;
+ if (first->protocol != htons(ETH_P_IP) &&
+ first->protocol != htons(ETH_P_IPV6) &&
+ first->protocol != htons(ETH_P_ARP))
+ return;
+
ring->atr_count++;
/* snag network header to get L4 type and address */
--
1.7.1
WARNING: multiple messages have this Message-ID (diff)
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Cc: sowmini.varadhan@oracle.com, alexander.duyck@gmail.com,
jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com,
shannon.nelson@intel.com, carolyn.wyborny@intel.com,
donald.c.skidmore@intel.com, bruce.w.allan@intel.com,
john.ronciak@intel.com, mitch.a.williams@intel.com
Subject: [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets
Date: Mon, 14 Mar 2016 13:46:24 -0400 [thread overview]
Message-ID: <20160314174624.GG5084@oracle.com> (raw)
For LLC based protocols like lldp, stp etc., the ethernet header
is an 802.3 header with a h_proto that is not 0x800, 0x86dd, or
even 0x806. In this world, the skb_network_header() points at
the DSAP/SSAP/.. and is not likely to be NET_IP_ALIGNed in
ixgbe_atr().
With LLC, drivers are not likely to correctly find IPVERSION,
or "6", at hdr.ipv4->version, but will instead just needlessly
trigger an unaligned access. (IPv4/IPv6 over LLC is almost never
implemented).
The unaligned access is thus avoidable: bail out quickly after
examining first->protocol.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
v2: Alexander Duyck comments.
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4d6223d..b25e603 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7574,6 +7574,11 @@ static void ixgbe_atr(struct ixgbe_ring *ring,
if (!ring->atr_sample_rate)
return;
+ if (first->protocol != htons(ETH_P_IP) &&
+ first->protocol != htons(ETH_P_IPV6) &&
+ first->protocol != htons(ETH_P_ARP))
+ return;
+
ring->atr_count++;
/* snag network header to get L4 type and address */
--
1.7.1
next reply other threads:[~2016-03-14 17:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 17:46 Sowmini Varadhan [this message]
2016-03-14 17:46 ` [PATCH v2 net-next] ixgbe: Avoid unaligned access in ixgbe_atr() for LLC packets Sowmini Varadhan
2016-03-14 17:55 ` [Intel-wired-lan] " Alexander Duyck
2016-03-14 17:55 ` Alexander Duyck
2016-03-14 17:59 ` [Intel-wired-lan] " Sowmini Varadhan
2016-03-14 17:59 ` Sowmini Varadhan
2016-03-14 19:20 ` [Intel-wired-lan] " Alexander Duyck
2016-03-14 19:20 ` Alexander Duyck
2016-03-14 19:32 ` [Intel-wired-lan] " Sowmini Varadhan
2016-03-14 19:32 ` 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=20160314174624.GG5084@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.