Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2109386ioo; Mon, 23 May 2022 10:14:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRs7RL9r4EmGO8HXWXKnQYpoSgCBHZb5vHLQWBXFvDuF0fsc+4TMNEAbRsu6KbJ5jC6wwG X-Received: by 2002:a65:4d0a:0:b0:3fa:2b27:5069 with SMTP id i10-20020a654d0a000000b003fa2b275069mr7442724pgt.56.1653326086821; Mon, 23 May 2022 10:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326086; cv=none; d=google.com; s=arc-20160816; b=M9AysDKhagYxWI032ajEzUNSfciDlm4aSMpENUvEvxBWMdYFkn1x9+9uKKNyEJ0auc WwGbpysXAiZ3GEZHXFfYNDOdOO4/9SsHor8D/gdTvEEVZCPrzlOR2kJf8NeVCUd7Bc+2 SjYNbM6tYKRB+h350YI+myUeIanvjti3LuALKMF+LMoRGvVdMR97AITlAx9rLbFsvZkK 9kOXBjAReKWUY8EBuSMF1WUf7YZQfbm7myI+ENdjM3OmsdhC+SXA8kVbTv8Y1Qyx1ps6 y2bJa3E+BOzJQZOXcLsHQN9uw4v9VLPDaAydpuRZRmUstOE/t9Q1aG6SE/uv3SjsIqQe WZjw== 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=ROnyrDnbhbo1bnLBRX1oyXCO3DVw2t7Xa30xttXb/+c=; b=ErGUJR+keDyKcEjUXpejj3tzgJix35BKILm6g8HLcTtghDZXcpum/9O7jyHVjhoU6j 4bhXtiRW/cQNaYRXmCYEw+Gn019UmkQ/HUMh8py+uk9zq6g0I2SuLH+bt3zcf2uw1k1S j2oVyMOPvIrn/fPQwsQWu2OQ11OX1XyiwS/uH2kC1nBpiMLcPMWqaN5qKAuugdfzXvML BdE9C7ETor2I3RWRQWAaiO0uadwV7YDox27UvnR8F314B7HVBhNbHsUCZqBgLTmrsPTV zM6KXnfqqjFI9P5XGuPnPEIkGEg1K3jYErxy2xPocSSGDfiddRhEmIVlNrOrnh6pkeN8 jL4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PQLxisfM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w19-20020a63fb53000000b003ab180a392esi11143077pgj.477.2022.05.23.10.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:14:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PQLxisfM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 E9EF670354; Mon, 23 May 2022 10:14:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239992AbiEWRNP (ORCPT + 99 others); Mon, 23 May 2022 13:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239976AbiEWRLa (ORCPT ); Mon, 23 May 2022 13:11:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3464D6CF60; Mon, 23 May 2022 10:10:48 -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 ams.source.kernel.org (Postfix) with ESMTPS id 71346B811FE; Mon, 23 May 2022 17:10:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB92CC385A9; Mon, 23 May 2022 17:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325819; bh=fiL5xmpicU4Z0vpo7J3ojLYAW+ShfyLlGTLoQTbPdiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQLxisfMlDNRftlifSr1yj+6J7OwfqpvnfsR+HKDhJjtHWcMi4pPIKfLWbo7Mbyot 96ELnJwND1/4XH4vWvoXUyKLzP5sOokbnZzMi98fnnnIoCtUDY6WLWGjJm7btPB5te G3//p/AlOT2tzd7ptOapRoZeyNpkr0QbvUgBfmfo= 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 4.19 21/44] net: macb: Increment rx bd head after allocating skb and buffer Date: Mon, 23 May 2022 19:05:05 +0200 Message-Id: <20220523165757.014597115@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165752.797318097@linuxfoundation.org> References: <20220523165752.797318097@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 d8e4842af055..50331b202f73 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -915,7 +915,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]) { @@ -954,6 +953,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