diff options
author | Eric Dumazet <edumazet@google.com> | 2013-05-13 21:25:52 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2013-06-29 04:06:35 +0100 |
commit | f3baed9f2b83a8e27b509c0afb8dc0e2a20b8f7e (patch) | |
tree | f6b039d09f56aae3e0e587ec40a82819d39cabb1 | |
parent | c32f3410245d666c5bea0e3b6e1e8aad6091b19f (diff) | |
download | lwn-f3baed9f2b83a8e27b509c0afb8dc0e2a20b8f7e.tar.gz lwn-f3baed9f2b83a8e27b509c0afb8dc0e2a20b8f7e.zip |
tcp: fix tcp_md5_hash_skb_data()
[ Upstream commit 54d27fcb338bd9c42d1dfc5a39e18f6f9d373c2e ]
TCP md5 communications fail [1] for some devices, because sg/crypto code
assume page offsets are below PAGE_SIZE.
This was discovered using mlx4 driver [2], but I suspect loopback
might trigger the same bug now we use order-3 pages in tcp_sendmsg()
[1] Failure is giving following messages.
huh, entered softirq 3 NET_RX ffffffff806ad230 preempt_count 00000100,
exited with 00000101?
[2] mlx4 driver uses order-2 pages to allocate RX frags
Reported-by: Matt Schnall <mischnal@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Bernhard Beck <bbeck@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | net/ipv4/tcp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index fe381c2d5e97..ec8b4b7ee2e2 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3037,8 +3037,11 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp, for (i = 0; i < shi->nr_frags; ++i) { const struct skb_frag_struct *f = &shi->frags[i]; - struct page *page = skb_frag_page(f); - sg_set_page(&sg, page, skb_frag_size(f), f->page_offset); + unsigned int offset = f->page_offset; + struct page *page = skb_frag_page(f) + (offset >> PAGE_SHIFT); + + sg_set_page(&sg, page, skb_frag_size(f), + offset_in_page(offset)); if (crypto_hash_update(desc, &sg, skb_frag_size(f))) return 1; } |