Commit 961c3c44 authored by Hayes Wang's avatar Hayes Wang Committed by sanglipeng
Browse files

r8152: check budget for r8152_poll()

stable inclusion
from stable-v5.10.195
commit ed584f1e72d754c2f69ece3eb08ed5734880721f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I95JOC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ed584f1e72d754c2f69ece3eb08ed5734880721f



--------------------------------

[ Upstream commit a7b8d60b ]

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: d2187f8e ("r8152: divide the tx and rx bottom functions")
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent ed976e35
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2439,6 +2439,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) {