From patchwork Mon Nov 13 17:42:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 13454275 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAA1D224ED for ; Mon, 13 Nov 2023 17:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tkos.co.il header.i=@tkos.co.il header.b="Wb0g/zz9" Received: from mail.tkos.co.il (mail.tkos.co.il [84.110.109.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7FE310F4 for ; Mon, 13 Nov 2023 09:49:32 -0800 (PST) Received: from tarshish.tkos.co.il (unknown [10.0.8.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.tkos.co.il (Postfix) with ESMTPS id 0143844064C; Mon, 13 Nov 2023 19:41:52 +0200 (IST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tkos.co.il; s=default; t=1699897313; bh=RLd7CYtbOxJsDnFRd7kaDxKZyPo0aj/FzvTE9nAfQmU=; h=From:To:Cc:Subject:Date:From; b=Wb0g/zz9WwdVDaGM5a1dhHMrBJ8097vMj2KraGTyzlTY3lIHs9rG8Tt7pWx69zRyG c8U5IujyC1oIPJUpBaTP4+hKTQl0ZA2gxZcEwSLO4ZyAnkldQbk7hOHKXIgPj7sgbm HRNp6M6Olib4Re0CzZ9lc8jOOFV7pzKM32fXFTupHjM84t8PeuLr8pXkVCxoAGOuZ0 xoXXhLVuIZ4BF7Q2FMxJn4XUQnso7pVNVXGjL2C1heI+6tEOoeynTtxePNo79KY9M/ GtCKp+J2v9zy/E3itMXx5Gy2tASdu/DPR2AADj1DWCvtZua0onVdWUMU6Sk0hly83y aUJhnpbu8r81w== From: Baruch Siach To: Alexandre Torgue , Jose Abreu Cc: netdev@vger.kernel.org, Baruch Siach Subject: [PATCH net 1/2] net: stmmac: fix rx budget limit check Date: Mon, 13 Nov 2023 19:42:49 +0200 Message-ID: X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The while loop condition verifies 'count < limit'. Neither value change before the 'count >= limit' check. As is this check is dead code. But code inspection reveals a code path that modifies 'count' and then goto 'drain_data' and back to 'read_again'. So there is a need to verify count value sanity after 'read_again'. Move 'read_again' up to fix the count limit check. Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support") Signed-off-by: Baruch Siach Reviewed-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3e50fd53a617..f28838c8cdb3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5328,10 +5328,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) len = 0; } +read_again: if (count >= limit) break; -read_again: buf1_len = 0; buf2_len = 0; entry = next_entry;