Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3683235lfo; Mon, 23 May 2022 11:18:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL1/z6sAyZ34UDEcYIWxJo/RBMtBoMOT+YL+XiIhwuB1fVezcQIKToqjxNoxTd07aM1c3Z X-Received: by 2002:a17:90a:2e83:b0:1da:3273:53ab with SMTP id r3-20020a17090a2e8300b001da327353abmr310657pjd.14.1653329936632; Mon, 23 May 2022 11:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653329936; cv=none; d=google.com; s=arc-20160816; b=QITmt8K5atOhymCkBIArSw6RtCMVEdj3naTEmYzf3R1Dhqaw3iJ9o2Vt/lcUxh0n5Q S0aAby/K/8Gz1f3oo7Tl4LkMqGPvZkoIjMkK+7WSPPSqfvgzTyRLs7BZIAnayacNEiyR 34PL77VQZ4/1h+3dDa7Q57IEbctoSHzAB9qEoivulZbf6er7cXHi/Ug/UGDCQc/TbV27 0CCB5qAP8Vbp5CWnaV+nUiMPBB/+HGug2ZJXWWUYuLtV2qPfHplXVIPV8Pk4cVB5La9N reZXEJzqUAhHgQH4TFrfKRjy57YdeCbxyQqaKDkO4E9nqh9Y/GTAQLjg1Ydn+rkYKRzr yBLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J6zWdnAf7S8BrQO0HkPH88ZOSrK9/4S9VSk6V0ly6rY=; b=Qo1dCCmwrVrzoHDgE/7GKQWQoWTZ/fxe3hnNqkmoi732HTbCy4koz1yOB5mrmsVeKB mtgbmWJQdblLgcC1l79BzmpQBTev8B88VdLV23dHhn5b7M3RuorIMnqacZ+sE7jiPc1L e3fLSSTvZcoGAwfvjq0z/RSB04sNOl49eVY1ZpnxeuzPvRviDQ0ByF2z5jioIsR5JmSn zhqRPJyC7WXkHfk5IdC7r8SGTuiWJBuUcCFwjspKzl70XL+Z1ihqb8sHjguKNz00TzwE KoY3d3rqa+ZE/bkdjygeJ+IJn4aDGcT5lG5399i+ScpC+46eyOZaD6otgHshMABiRvIq Wrqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kcmZ9j3c; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y18-20020a170902ed5200b0015ec7011390si9574816plb.256.2022.05.23.11.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:18:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kcmZ9j3c; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43A313883; Mon, 23 May 2022 11:15:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242782AbiEWSBH (ORCPT + 99 others); Mon, 23 May 2022 14:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239485AbiEWRc5 (ORCPT ); Mon, 23 May 2022 13:32:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A57C972226; Mon, 23 May 2022 10:27:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C373660919; Mon, 23 May 2022 17:27:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B9DC385A9; Mon, 23 May 2022 17:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326857; bh=vEwnCoTV8sEf0purtv7I8tz1p6UatV09CLsl4plOqKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kcmZ9j3cXq/sADm+DPzjaP3x1JyFeVPV0dvgV6BT47Mllam7h1kL76oDSk3vdKkG4 mchgHLVqrAOgfikdiAtGavxV4VHEQJmhRKklXXdjAqSzorAuKCHHQFZG6TAOkuolmc smFkORBJYUxgk19aXxyEsDbHU7y63WZqObQnxWMs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harini Katakam , Michal Simek , Radhey Shyam Pandey , Claudiu Beznea , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.17 080/158] net: macb: Increment rx bd head after allocating skb and buffer Date: Mon, 23 May 2022 19:03:57 +0200 Message-Id: <20220523165844.315462395@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165830.581652127@linuxfoundation.org> References: <20220523165830.581652127@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Harini Katakam [ Upstream commit 9500acc631dbb8b73166e25700e656b11f6007b6 ] In gem_rx_refill rx_prepared_head is incremented at the beginning of the while loop preparing the skb and data buffers. If the skb or data buffer allocation fails, this BD will be unusable BDs until the head loops back to the same BD (and obviously buffer allocation succeeds). In the unlikely event that there's a string of allocation failures, there will be an equal number of unusable BDs and an inconsistent RX BD chain. Hence increment the head at the end of the while loop to be clean. Fixes: 4df95131ea80 ("net/macb: change RX path for GEM") Signed-off-by: Harini Katakam Signed-off-by: Michal Simek Signed-off-by: Radhey Shyam Pandey Reviewed-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220512171900.32593-1-harini.katakam@xilinx.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index c4f4b13ac469..c1100af5666b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1217,7 +1217,6 @@ static void gem_rx_refill(struct macb_queue *queue) /* Make hw descriptor updates visible to CPU */ rmb(); - queue->rx_prepared_head++; desc = macb_rx_desc(queue, entry); if (!queue->rx_skbuff[entry]) { @@ -1256,6 +1255,7 @@ static void gem_rx_refill(struct macb_queue *queue) dma_wmb(); desc->addr &= ~MACB_BIT(RX_USED); } + queue->rx_prepared_head++; } /* Make descriptor updates visible to hardware */ -- 2.35.1