From: Vasily Averin <v...@virtuozzo.com>

sendpage was not designed for processing of the Slab pages,
in some situations it can trigger BUG_ON on receiving side.

Signed-off-by: Vasily Averin <v...@virtuozzo.com>
Signed-off-by: Eric Dumazet <eduma...@google.com>
Signed-off-by: David S. Miller <da...@davemloft.net>

(cherry-picked from ms a10674bf2406 ("tcp: detecting the misuse of .sendpage 
for Slab objects"))
Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4196685..538d63c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -961,6 +961,10 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page 
*page, int offset,
        ssize_t copied;
        long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
 
+       if (IS_ENABLED(CONFIG_DEBUG_VM) &&
+           WARN_ONCE(PageSlab(page), "page must not be a Slab one"))
+               return -EINVAL;
+
        /* Wait for a connection to finish. One exception is TCP Fast Open
         * (passive side) where data is allowed to be sent before a connection
         * is fully established.
-- 
1.8.3.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to