[Devel] [PATCH RH76 v2] tcp: sendpage should not handle Slab objects
Vasily Averin
vvs at virtuozzo.com
Mon Mar 4 08:50:01 MSK 2019
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.
v2: properly backported to rhel76 kernel
https://jira.sw.ru/browse/PSBM-90529
Signed-off-by: Vasily Averin <vvs at virtuozo.com>
-------------- next part --------------
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e74c83789279..dcfaf4ff70e1 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1006,6 +1006,13 @@ int tcp_sendpage(struct sock *sk, struct page *page, int offset,
return sock_no_sendpage(sk->sk_socket, page, offset, size,
flags);
+ if (PageSlab(page)) {
+ WARN_ONCE(true, "sendpage should not handle Slab objects,"
+ " please fix callers\n");
+ return sock_no_sendpage(sk->sk_socket, page, offset, size,
+ flags);
+ }
+
lock_sock(sk);
res = do_tcp_sendpages(sk, page, offset, size, flags);
release_sock(sk);
More information about the Devel
mailing list