Skip to contentSkip to conversation

netfilter: fix unaligned memory access in tcp_sack

PATCH In review Mark H. Weaver 3 participants 4 messages Mar 23, 2009 – Mar 24, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: 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

More details provided upon request. Apologies in advance if I've sent this to the wrong place or not followed proper procedures.

Best,
Mark

net/netfilter/nf_conntrack_proto_tcp.c renamed from net/netfilter/nf_conntrack_proto_tcp.c.orig +2 -1
@@ -15,6 +15,7 @@
 #include <linux/skbuff.h>
 #include <linux/ipv6.h>
 #include <net/ip6_checksum.h>
+#include <asm/unaligned.h>
 
 #include <net/tcp.h>
 
@@ -466,7 +467,7 @@ static void tcp_sack(const struct sk_buf
 				for (i = 0;
 				     i < (opsize - TCPOLEN_SACK_BASE);
 				     i += TCPOLEN_SACK_PERBLOCK) {
-					tmp = ntohl(*((__be32 *)(ptr+i)+1));
+					tmp = get_unaligned_be32((__be32 *)(ptr+i)+1);
 
 					if (after(tmp, *sack))
 						*sack = tmp;
maintainer Acked-by on v1 1/1
#1 lore raw

From: "Mark H. Weaver" <[email protected]>
Date: Sun, 22 Mar 2009 23:09:51 -0400

Quoted 9 lines

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

More details provided upon request. Apologies in advance if I've sent this to the wrong place or not followed proper procedures.

#2 lore raw
Quoted 8 lines · David Miller

From: "Mark H. Weaver" <[email protected]>
Date: Sun, 22 Mar 2009 23:09:51 -0400

Quoted 5 lines

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:

Quoted 6 lines
Quoted 4 lines
  [54678.532071] Kernel unaligned access at TPC[6b17d4] tcp_packet+0xcd4/0xd00

More details provided upon request. Apologies in advance if I've sent this to the wrong place or not followed proper procedures.

Looks good to me. Dave, please apply directly or pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git

Thanks!

maintainer
#3 lore raw

From: Patrick McHardy <[email protected]>
Date: Mon, 23 Mar 2009 13:48:24 +0100

Quoted 3 lines

Looks good to me. Dave, please apply directly or pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git

Pulled, thanks Patrick.