]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: use sendpage_ok() to detect misused .sendpage
authorColy Li <colyli@suse.de>
Fri, 2 Oct 2020 08:27:31 +0000 (16:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Oct 2020 22:27:08 +0000 (15:27 -0700)
commit0a43df573e2ca8ec54e399f2a592bb06fd949d68
treebd90a7efe648a0b8c2d75ca0a1dcaa4d6b89610d
parent13e07f016582c4be1f19578ba882ffb9f26a1556
tcp: use sendpage_ok() to detect misused .sendpage

commit db371bbcc19c ("tcp: detecting the misuse of .sendpage for Slab
objects") adds the checks for Slab pages, but the pages don't have
page_count are still missing from the check.

Network layer's sendpage method is not designed to send page_count 0
pages neither, therefore both PageSlab() and page_count() should be
both checked for the sending page. This is exactly what sendpage_ok()
does.

This patch uses sendpage_ok() in do_tcp_sendpages() to detect misused
.sendpage, to make the code more robust.

Fixes: db371bbcc19c ("tcp: detecting the misuse of .sendpage for Slab objects")
Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Vasily Averin <vvs@virtuozzo.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: stable@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c