[Devel] [PATCH RHEL7 COMMIT] tcp: sendpage should not handle Slab objects
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Mar 4 17:18:55 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.5.1.vz7.84.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.5.1.vz7.84.2
------>
commit 6c05ade2b7ac2a01139a35d4bef3e838f741368f
Author: Vasily Averin <vvs at virtuozzo.com>
Date: Mon Mar 4 17:18:52 2019 +0300
tcp: sendpage should not handle Slab objects
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 <vvs at virtuozo.com>
---
net/ipv4/tcp.c | 7 +++++++
1 file changed, 7 insertions(+)
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