750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. From: Alexander Duyck <[email protected]>
  2. Date: Thu, 26 Jan 2023 11:06:59 -0800
  3. Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO
  4. GSO should not merge page pool recycled frames with standard reference
  5. counted frames. Traditionally this didn't occur, at least not often.
  6. However as we start looking at adding support for wireless adapters there
  7. becomes the potential to mix the two due to A-MSDU repartitioning frames in
  8. the receive path. There are possibly other places where this may have
  9. occurred however I suspect they must be few and far between as we have not
  10. seen this issue until now.
  11. Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool")
  12. Reported-by: Felix Fietkau <[email protected]>
  13. Signed-off-by: Alexander Duyck <[email protected]>
  14. ---
  15. --- a/net/core/skbuff.c
  16. +++ b/net/core/skbuff.c
  17. @@ -4360,6 +4360,15 @@ int skb_gro_receive(struct sk_buff *p, s
  18. if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush))
  19. return -E2BIG;
  20. + /* Do not splice page pool based packets w/ non-page pool
  21. + * packets. This can result in reference count issues as page
  22. + * pool pages will not decrement the reference count and will
  23. + * instead be immediately returned to the pool or have frag
  24. + * count decremented.
  25. + */
  26. + if (p->pp_recycle != skb->pp_recycle)
  27. + return -ETOOMANYREFS;
  28. +
  29. lp = NAPI_GRO_CB(p)->last;
  30. pinfo = skb_shinfo(lp);