Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp794191pxb; Tue, 12 Apr 2022 13:38:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVsw0M0gf+KG4X4pZjbA6HAU7kg+lLxf5yP91/Cbc903WT0r8Xugx3X/7k8t05B2ZZ4d5R X-Received: by 2002:a17:90b:164f:b0:1c7:8d20:ff6d with SMTP id il15-20020a17090b164f00b001c78d20ff6dmr6992965pjb.64.1649795936235; Tue, 12 Apr 2022 13:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649795936; cv=none; d=google.com; s=arc-20160816; b=yNdKZyCAOM0ZXdqxWJeBzwJbeWU3/WT/ye0HkrAr0NHyggJmBcCMvzCcGez2gUFLVF 86BM1749lBU/kITOTsWzdJZ9/Y25rAtUPZ5bcfJPtuWMDakcGb9OUjbbWChJsrI4/dWr cCTERbGq5hX8k5qenZNKRsOZxNTIAGonQCO//xvMhXQR8vkZWrSCoQl/1WPpqI0weurq zWnT7RDAkzfNdZY9kU1DMDOrCSI5VxaZ+sdiVpkRwH3cdwnIGjoTNwv0vxIV8x3VyGOj +EYg5jBaIPb8JA/1c8Q6EYGfyi0NZNJ2T6zBASsEvipEnnHwDNXdYP30vO+zFHtwCboD y27A== 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=hcJ+fELQWx2bQ6iCQCDbMmXAcrYbUhkspB0ipmzXYZg=; b=a9JD0JCg+409UHgC9Dt1rPRupcCPiR7eQIZmviAYEnqZyRE11+jCCah/xjSmgLpjBc 985aTit3fW/+VN36DyRCokHGIYNMn/jx/+c+juH55n1+8+oI2A6uPn+6JVXcZ2zkzU+6 y3UhJ1oIzN0Ghs4YpPSBL0EqwSelhLCniooY9edcd6K2UNjL/4QYHeOYjGWObwzSZ4wW cdQBeDt6HSfzpgdJiAKnW6TfUa8bdCpVdC3czmVQ2qkv6TQeIEzDlVf1XegDavOU2AU+ hsvBQxZDwPoTKBCaYip1nEvr9zY5YcXcQ4xUoeIIDdNKstriSqkfxkkYge7zEL6K8aQ/ J/mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BE6xPM2u; 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 i190-20020a6387c7000000b00382773de76csi3468663pge.9.2022.04.12.13.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:38: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=BE6xPM2u; 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 0F2E3B36B7; Tue, 12 Apr 2022 13:12:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358457AbiDLIaG (ORCPT + 99 others); Tue, 12 Apr 2022 04:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353595AbiDLHZs (ORCPT ); Tue, 12 Apr 2022 03:25:48 -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 22B6326126; Tue, 12 Apr 2022 00:02:04 -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 CCCFDB81B4E; Tue, 12 Apr 2022 07:02:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A54EC385A6; Tue, 12 Apr 2022 07:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649746921; bh=6uhKsBVK/85T0zV+8oTAuD9p40iNznVFuvXgxUB+jLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BE6xPM2uV9rC3yDbFBhQd8Jf4DZ1lrrCLi8sQGbYF5rZrb+Qcdfc73g5pykRNjvm6 sm0m3NPPnwS9UgiLt6fsN4jBL/WxMwhl7XUp9l/u7vnkWSmaFTuf8v0PsvYaKyskrE RdfFnOAdgJI2GGNPYLatE2/2M9Gl8wzipC9EQMXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Martin Habets , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 178/285] sfc: Do not free an empty page_ring Date: Tue, 12 Apr 2022 08:30:35 +0200 Message-Id: <20220412062948.804765167@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062943.670770901@linuxfoundation.org> References: <20220412062943.670770901@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.0 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=no 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: Martin Habets [ Upstream commit 458f5d92df4807e2a7c803ed928369129996bf96 ] When the page_ring is not used page_ptr_mask is 0. Do not dereference page_ring[0] in this case. Fixes: 2768935a4660 ("sfc: reuse pages to avoid DMA mapping/unmapping costs") Reported-by: Taehee Yoo Signed-off-by: Martin Habets Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/sfc/rx_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c index 633ca77a26fd..b925de9b4302 100644 --- a/drivers/net/ethernet/sfc/rx_common.c +++ b/drivers/net/ethernet/sfc/rx_common.c @@ -166,6 +166,9 @@ static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue) struct efx_nic *efx = rx_queue->efx; int i; + if (unlikely(!rx_queue->page_ring)) + return; + /* Unmap and release the pages in the recycle ring. Remove the ring. */ for (i = 0; i <= rx_queue->page_ptr_mask; i++) { struct page *page = rx_queue->page_ring[i]; -- 2.35.1