Merge branch 'Introduce-sendpage_ok-to-detect-misused-sendpage-in-network-related...
authorDavid S. Miller <davem@davemloft.net>
Fri, 2 Oct 2020 22:27:08 +0000 (15:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Oct 2020 22:27:08 +0000 (15:27 -0700)
commite7d4005d48e248a5bd30db780a67164ccdc37f16
treeb9afe6c323f391becaa8b69706659bfb58703bc2
parentf30e25a9d1b25ac8d40071c4dc2679ad0fcdc55a
parent40efc4dc73956e1fab177783e55f30117517c542
Merge branch 'Introduce-sendpage_ok-to-detect-misused-sendpage-in-network-related-drivers'

Coly Li says:

====================
Introduce sendpage_ok() to detect misused sendpage in network related drivers

As Sagi Grimberg suggested, the original fix is refind to a more common
inline routine:
    static inline bool sendpage_ok(struct page *page)
    {
        return  (!PageSlab(page) && page_count(page) >= 1);
    }
If sendpage_ok() returns true, the checking page can be handled by the
concrete zero-copy sendpage method in network layer.

The v10 series has 7 patches, fixes a WARN_ONCE() usage from v9 series,
- The 1st patch in this series introduces sendpage_ok() in header file
  include/linux/net.h.
- The 2nd patch adds WARN_ONCE() for improper zero-copy send in
  kernel_sendpage().
- The 3rd patch fixes the page checking issue in nvme-over-tcp driver.
- The 4th patch adds page_count check by using sendpage_ok() in
  do_tcp_sendpages() as Eric Dumazet suggested.
- The 5th and 6th patches just replace existing open coded checks with
  the inline sendpage_ok() routine.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>