0718-v6.0-net-lantiq_xrx200-fix-lock-under-memory-pressure.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. From c4b6e9341f930e4dd089231c0414758f5f1f9dbd Mon Sep 17 00:00:00 2001
  2. From: Aleksander Jan Bajkowski <[email protected]>
  3. Date: Wed, 24 Aug 2022 23:54:07 +0200
  4. Subject: [PATCH] net: lantiq_xrx200: fix lock under memory pressure
  5. When the xrx200_hw_receive() function returns -ENOMEM, the NAPI poll
  6. function immediately returns an error.
  7. This is incorrect for two reasons:
  8. * the function terminates without enabling interrupts or scheduling NAPI,
  9. * the error code (-ENOMEM) is returned instead of the number of received
  10. packets.
  11. After the first memory allocation failure occurs, packet reception is
  12. locked due to disabled interrupts from DMA..
  13. Fixes: fe1a56420cf2 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver")
  14. Signed-off-by: Aleksander Jan Bajkowski <[email protected]>
  15. Signed-off-by: Jakub Kicinski <[email protected]>
  16. ---
  17. drivers/net/ethernet/lantiq_xrx200.c | 2 +-
  18. 1 file changed, 1 insertion(+), 1 deletion(-)
  19. --- a/drivers/net/ethernet/lantiq_xrx200.c
  20. +++ b/drivers/net/ethernet/lantiq_xrx200.c
  21. @@ -294,7 +294,7 @@ static int xrx200_poll_rx(struct napi_st
  22. if (ret == XRX200_DMA_PACKET_IN_PROGRESS)
  23. continue;
  24. if (ret != XRX200_DMA_PACKET_COMPLETE)
  25. - return ret;
  26. + break;
  27. rx++;
  28. } else {
  29. break;