Skip to content

Commit

Permalink
r8152: check budget for r8152_poll()
Browse files Browse the repository at this point in the history
[ Upstream commit a7b8d60 ]

According to the document of napi, there is no rx process when the
budget is 0. Therefore, r8152_poll() has to return 0 directly when the
budget is equal to 0.

Fixes: d2187f8 ("r8152: divide the tx and rx bottom functions")
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
hayesorz authored and gregkh committed Sep 19, 2023
1 parent 44c8ffd commit 2323397
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/usb/r8152.c
Expand Up @@ -2628,6 +2628,9 @@ static int r8152_poll(struct napi_struct *napi, int budget)
struct r8152 *tp = container_of(napi, struct r8152, napi);
int work_done;

if (!budget)
return 0;

work_done = rx_bottom(tp, budget);

if (work_done < budget) {
Expand Down

0 comments on commit 2323397

Please sign in to comment.