According to network guru .sendpage should not handle Slab objects.
The patch helps to detects such incidents, generates warning
and switch processing to safe .sendmsg callback.

https://jira.sw.ru/browse/PSBM-90529
Signed-off-by: Vasily Averin <[email protected]>
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e74c83789279..d22300e025d8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -887,6 +887,11 @@ static 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 (PageSlab(page)) {
+               WARN_ONCE(true, "sendpage should not handle Slab objects,"
+                               " please fix callers\n");
+               return sock_no_sendpage_locked(sk, page, offset, size, flags);
+       }
        /* 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.
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to