aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMark H. Weaver <mhw@netris.org>2009-03-23 08:46:12 -0400
committerPatrick McHardy <kaber@trash.net>2009-03-23 08:46:12 -0400
commit534f81a5068799799e264fd162e9488a129f98d4 (patch)
tree541efbf72b69d3c834b5aaffdb1b6e462344bf4f /net
parentd1238d5337e8e53cddea77c2a26d26b6eb5a982f (diff)
netfilter: nf_conntrack_tcp: fix unaligned memory access in tcp_sack
This patch fixes an unaligned memory access in tcp_sack while reading sequence numbers from TCP selective acknowledgement options. Prior to applying this patch, upstream linux-2.6.27.20 was occasionally generating messages like this on my sparc64 system: [54678.532071] Kernel unaligned access at TPC[6b17d4] tcp_packet+0xcd4/0xd00 Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index f3fd154d1ddd..56ac4ee77a1d 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -15,6 +15,7 @@
15#include <linux/skbuff.h> 15#include <linux/skbuff.h>
16#include <linux/ipv6.h> 16#include <linux/ipv6.h>
17#include <net/ip6_checksum.h> 17#include <net/ip6_checksum.h>
18#include <asm/unaligned.h>
18 19
19#include <net/tcp.h> 20#include <net/tcp.h>
20 21
@@ -466,7 +467,7 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,
466 for (i = 0; 467 for (i = 0;
467 i < (opsize - TCPOLEN_SACK_BASE); 468 i < (opsize - TCPOLEN_SACK_BASE);
468 i += TCPOLEN_SACK_PERBLOCK) { 469 i += TCPOLEN_SACK_PERBLOCK) {
469 tmp = ntohl(*((__be32 *)(ptr+i)+1)); 470 tmp = get_unaligned_be32((__be32 *)(ptr+i)+1);
470 471
471 if (after(tmp, *sack)) 472 if (after(tmp, *sack))
472 *sack = tmp; 473 *sack = tmp;