Skip to content

Commit b82981f

Browse files
Shannon Nelsongregkh
authored andcommitted
tcp: fix tcp_fastopen unaligned access complaints on sparc
[ Upstream commit 003c941057eaa868ca6fedd29a274c863167230d ] Fix up a data alignment issue on sparc by swapping the order of the cookie byte array field with the length field in struct tcp_fastopen_cookie, and making it a proper union to clean up the typecasting. This addresses log complaints like these: log_unaligned: 113 callbacks suppressed Kernel unaligned access at TPC[976490] tcp_try_fastopen+0x2d0/0x360 Kernel unaligned access at TPC[9764ac] tcp_try_fastopen+0x2ec/0x360 Kernel unaligned access at TPC[9764c8] tcp_try_fastopen+0x308/0x360 Kernel unaligned access at TPC[9764e4] tcp_try_fastopen+0x324/0x360 Kernel unaligned access at TPC[976490] tcp_try_fastopen+0x2d0/0x360 Cc: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ec9e993 commit b82981f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

include/linux/tcp.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
5656

5757
/* TCP Fast Open Cookie as stored in memory */
5858
struct tcp_fastopen_cookie {
59+
union {
60+
u8 val[TCP_FASTOPEN_COOKIE_MAX];
61+
#if IS_ENABLED(CONFIG_IPV6)
62+
struct in6_addr addr;
63+
#endif
64+
};
5965
s8 len;
60-
u8 val[TCP_FASTOPEN_COOKIE_MAX];
6166
bool exp; /* In RFC6994 experimental option format */
6267
};
6368

net/ipv4/tcp_fastopen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static bool tcp_fastopen_cookie_gen(struct request_sock *req,
112112
struct tcp_fastopen_cookie tmp;
113113

114114
if (__tcp_fastopen_cookie_gen(&ip6h->saddr, &tmp)) {
115-
struct in6_addr *buf = (struct in6_addr *) tmp.val;
115+
struct in6_addr *buf = &tmp.addr;
116116
int i;
117117

118118
for (i = 0; i < 4; i++)

0 commit comments

Comments
 (0)