1 |
From 923e36189a7705f3b700a55375d8612f31755dce Mon Sep 17 00:00:00 2001 |
2 |
From: Sasha Levin <sashal@kernel.org> |
3 |
Date: Wed, 24 Aug 2022 23:54:07 +0200 |
4 |
Subject: net: lantiq_xrx200: fix lock under memory pressure |
5 |
|
6 |
From: Aleksander Jan Bajkowski <olek2@wp.pl> |
7 |
|
8 |
[ Upstream commit c4b6e9341f930e4dd089231c0414758f5f1f9dbd ] |
9 |
|
10 |
When the xrx200_hw_receive() function returns -ENOMEM, the NAPI poll |
11 |
function immediately returns an error. |
12 |
This is incorrect for two reasons: |
13 |
* the function terminates without enabling interrupts or scheduling NAPI, |
14 |
* the error code (-ENOMEM) is returned instead of the number of received |
15 |
packets. |
16 |
|
17 |
After the first memory allocation failure occurs, packet reception is |
18 |
locked due to disabled interrupts from DMA.. |
19 |
|
20 |
Fixes: fe1a56420cf2 ("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver") |
21 |
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> |
22 |
Signed-off-by: Jakub Kicinski <kuba@kernel.org> |
23 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
24 |
--- |
25 |
drivers/net/ethernet/lantiq_xrx200.c | 2 +- |
26 |
1 file changed, 1 insertion(+), 1 deletion(-) |
27 |
|
28 |
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c |
29 |
index 89314b645c822..25adce7f0c7c0 100644 |
30 |
--- a/drivers/net/ethernet/lantiq_xrx200.c |
31 |
+++ b/drivers/net/ethernet/lantiq_xrx200.c |
32 |
@@ -294,7 +294,7 @@ static int xrx200_poll_rx(struct napi_struct *napi, int budget) |
33 |
if (ret == XRX200_DMA_PACKET_IN_PROGRESS) |
34 |
continue; |
35 |
if (ret != XRX200_DMA_PACKET_COMPLETE) |
36 |
- return ret; |
37 |
+ break; |
38 |
rx++; |
39 |
} else { |
40 |
break; |
41 |
-- |
42 |
2.35.1 |
43 |
|