Unaligned kernel loads and stores must be properly handled by the
platform code, and on ARM chips where that is possible it is.
Nevertheless, if you'd like to rule this out, please try the
patch below:
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore vanilla/linux/net/ipv4/tcp_input.c linux/net/ipv4/tcp_input.c
--- vanilla/linux/net/ipv4/tcp_input.c Tue Oct 30 15:08:12 2001
+++ linux/net/ipv4/tcp_input.c Tue Nov 6 15:48:01 2001
@@ -1987,6 +1987,18 @@
return 0;
}
+static __inline__ __u16 tcp_options_get16(unsigned char *p)
+{
+ return ((__u16) p[0] << 8) | (__u16) p[1];
+}
+
+static __inline__ __u32 tcp_options_get32(unsigned char *p)
+{
+ return (((__u32) p[0] << 24) |
+ ((__u32) p[1] << 16) |
+ ((__u32) p[2] << 8) |
+ ((__u32) p[3] << 0));
+}
/* Look for tcp options. Normally only called on SYN and SYNACK packets.
* But, this can also be called on packets in the established flow when
@@ -2020,7 +2032,7 @@
switch(opcode) {
case TCPOPT_MSS:
if(opsize==TCPOLEN_MSS && th->syn && !estab) {
- u16 in_mss = ntohs(*(__u16 *)ptr);
+ u16 in_mss = tcp_options_get16(ptr);
if (in_mss) {
if (tp->user_mss && tp->user_mss < in_mss)
in_mss = tp->user_mss;
@@ -2047,8 +2059,8 @@
if ((estab && tp->tstamp_ok) ||
(!estab && sysctl_tcp_timestamps)) {
tp->saw_tstamp = 1;
- tp->rcv_tsval = ntohl(*(__u32 *)ptr);
- tp->rcv_tsecr = ntohl(*(__u32 *)(ptr+4));
+ tp->rcv_tsval = tcp_options_get32(ptr);
+ tp->rcv_tsecr = tcp_options_get32(ptr + 4);
}
}
break;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/