Message ID | 20240910014210.1052063-3-koichiro.den@canonical.com |
---|---|
State | New |
Headers | show |
Series | CVE-2024-26640 | expand |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 7510e1937734..2ca02dc695b2 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1755,7 +1755,17 @@ EXPORT_SYMBOL(tcp_mmap); static bool can_map_frag(const skb_frag_t *frag) { - return skb_frag_size(frag) == PAGE_SIZE && !skb_frag_off(frag); + struct page *page; + + if (skb_frag_size(frag) != PAGE_SIZE || skb_frag_off(frag)) + return false; + + page = skb_frag_page(frag); + + if (PageCompound(page) || page->mapping) + return false; + + return true; } static int find_next_mappable_frag(const skb_frag_t *frag,