[3.16.y-ckt extended stable] Patch "net: tso: fix unaligned access to crafted TCP header in helper API" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Mon Nov 10 11:32:19 UTC 2014


This is a note to let you know that I have just added a patch titled

    net: tso: fix unaligned access to crafted TCP header in helper API

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.16.y-queue

This patch is scheduled to be released in version 3.16.7-ckt1.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 598d27687007664f53512bfbbd19476b12293035 Mon Sep 17 00:00:00 2001
From: Karl Beldan <karl.beldan at rivierawaves.com>
Date: Tue, 21 Oct 2014 16:06:05 +0200
Subject: net: tso: fix unaligned access to crafted TCP header in helper API

commit a63ba13eec092b70d4e5522d692eaeb2f9747387 upstream.

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 at rivierawaves.com>
Cc: Ezequiel Garcia <ezequiel.garcia at free-electrons.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 net/core/tso.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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) {
--
2.1.0





More information about the kernel-team mailing list