Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2117073ioo; Mon, 23 May 2022 10:25:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+3O27Lt1HDbATbZSO5e8eDk0OHIFoe92M1MKPG+BgCV5PPmSY414F4cenK2C5w9sFeKsv X-Received: by 2002:a17:90a:6ac5:b0:1df:77a0:a72f with SMTP id b5-20020a17090a6ac500b001df77a0a72fmr55883pjm.125.1653326709152; Mon, 23 May 2022 10:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326709; cv=none; d=google.com; s=arc-20160816; b=M+7+xl7Coo1jSelD7JUB72NmRRcwV7mWPpivEB6TT0DKcXZTk1to6e9SQcy2a/AIc2 0neo3Q7bSEvGBrXBXJ/zrOqykY70Tcxqn9dWNI++Uh2UTj+AtpiARMVhlf3zN2IO7mUE ocqCreujcvssq+3yyLPOFz7zQmxcgLxyC3RmJS+C5UUkzNW/C1weFITdG1VlwUPTe0Dx u584qgOcfjETlNGVW2F1tzzL25YEsBqOpGNea9HXS8Scs8Qz2G3QgNP0riSK2ictDFyG 0yqx4TjFEgn7X6IKvr//Jff0ihugRg2ELxglfCAlmn48OYo55r7lmjrlfMKh7O1f4hM3 mwVw== 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=obkw57k5snWocASDHxeSmHKu88ydd0cHWLM12zXL4Co=; b=SFWPEthfh05fMdUDzYKpCAew5KhgZCecOU6YbvW4fXRqdd5qrH6iS4r5lMUWAlaY5o 5svzMreftt6UDGQhiE6SwmT41EWybln0VlQrflCdRSe2e4dRjaSk+DWuAFwoxvm/A+QS IgwtKq+YyQIbwSx1tAHdFhinN4r2gpELw4/IbIaO/z7LE9R8IM9GnzEgeaX6Rn9wfflO Re/3k4qovEPaLJwcXM9Y6pcOzoane3eh0rp8I9Nm2+zkB2w+UPqSTSOYogHOM5gaF8FJ ff3QHm9wjFU0MekYwb54QQAKAue2I77yn3htyVMNsI4XvsXQslnGhRObM0bP3rZ+mfZd 4cNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xZuBSwdd; 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 h185-20020a6383c2000000b003fa3f7ea593si5928806pge.800.2022.05.23.10.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:25:09 -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=xZuBSwdd; 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 0D71F8D698; Mon, 23 May 2022 10:24:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239948AbiEWRUf (ORCPT + 99 others); Mon, 23 May 2022 13:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240930AbiEWRQt (ORCPT ); Mon, 23 May 2022 13:16:49 -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 2CB9C6B642; Mon, 23 May 2022 10:16:40 -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 AF525614CC; Mon, 23 May 2022 17:13:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D6B4C34116; Mon, 23 May 2022 17:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325999; bh=eGrDYHXmFsVRcikTzncgPsM+vtr5k2y/DS+DjMqwsuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xZuBSwddFeUd5Q30VC71nv+s/PdcigPKbPZIS/ENIu8fNd1WokqM+Zoxp88ekqINe TGbzAlMrPyYHNu24WFQXsUk4qQ1AUbJE4x/Q95YEZBgidh5uhzrLnGuA5Enn5pGGzq ajEORzZjz3MkLysfyVFdlhtq8wkZflEyJRExx+5s= 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.4 36/68] net: macb: Increment rx bd head after allocating skb and buffer Date: Mon, 23 May 2022 19:05:03 +0200 Message-Id: <20220523165808.545233035@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@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 002a374f197b..78219a9943a7 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -927,7 +927,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]) { @@ -966,6 +965,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