summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKarl Beldan <karl.beldan@rivierawaves.com>2014-10-21 16:06:05 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-14 10:10:21 -0800
commitbd1313d7e0bf33eb59d3e3883d79e0ebde75b5e5 (patch)
tree16c655ac2ff156e135a57fb550fd79c1fbaaa051 /net
parent4a1ea31c839bb96e1267b4118c09354ecc8acb64 (diff)
net: tso: fix unaligned access to crafted TCP header in helper API
[ Upstream commit a63ba13eec092b70d4e5522d692eaeb2f9747387 ] The crafted header start address is from a driver supplied buffer, which one can reasonably expect to be aligned on a 4-bytes boundary. However ATM the TSO helper API is only used by ethernet drivers and the tcp header will then be aligned to a 2-bytes only boundary from the header start address. Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/tso.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/tso.c b/net/core/tso.c
index 8c3203c585b0..630b30b4fb53 100644
--- a/net/core/tso.c
+++ b/net/core/tso.c
@@ -1,6 +1,7 @@
#include <linux/export.h>
#include <net/ip.h>
#include <net/tso.h>
+#include <asm/unaligned.h>
/* Calculate expected number of TX descriptors */
int tso_count_descs(struct sk_buff *skb)
@@ -23,7 +24,7 @@ void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso,
iph->id = htons(tso->ip_id);
iph->tot_len = htons(size + hdr_len - mac_hdr_len);
tcph = (struct tcphdr *)(hdr + skb_transport_offset(skb));
- tcph->seq = htonl(tso->tcp_seq);
+ put_unaligned_be32(tso->tcp_seq, &tcph->seq);
tso->ip_id++;
if (!is_last) {