Commit 54d27fcb338bd9c42d1dfc5a39e18f6f9d373c2e
Committed by
David S. Miller
1 parent
efee8e8712
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
tcp: fix tcp_md5_hash_skb_data()
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>
Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff
net/ipv4/tcp.c
... | ... | @@ -3269,8 +3269,11 @@ |
3269 | 3269 | |
3270 | 3270 | for (i = 0; i < shi->nr_frags; ++i) { |
3271 | 3271 | const struct skb_frag_struct *f = &shi->frags[i]; |
3272 | - struct page *page = skb_frag_page(f); | |
3273 | - sg_set_page(&sg, page, skb_frag_size(f), f->page_offset); | |
3272 | + unsigned int offset = f->page_offset; | |
3273 | + struct page *page = skb_frag_page(f) + (offset >> PAGE_SHIFT); | |
3274 | + | |
3275 | + sg_set_page(&sg, page, skb_frag_size(f), | |
3276 | + offset_in_page(offset)); | |
3274 | 3277 | if (crypto_hash_update(desc, &sg, skb_frag_size(f))) |
3275 | 3278 | return 1; |
3276 | 3279 | } |