From patchwork Thu Feb 3 10:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 12734011 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EDFDC433EF for ; Thu, 3 Feb 2022 10:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=IYpyNOubrI+HARR4fDT5qHZGHBBB9yzVCXlLyz0b0gk=; b=okM1rTjL8GUOeO fa61qd5XtvfSNE+A92Y9xISBymw3yVaMVdXS6Ebjnw4CUYSYA0K10bDebGSioS/WAxSA7wCbF2rN8 zz51ZT/SzBxcUuer8UF78kcNSi4Tm/UI3IpKjq/FTkArjCK32VQ8YGAhNvPQwTcHBa8d3yY+BPE6o aMzDfoDeSdPOu1QBVsex3MubFRLek7/nOy5E2HRKsMuM/cT4yNEq+8DWiCxKlUWHcEBemwWI+hY44 gTU2DN2heyriSIOK4JpRBXmyBtgsa+25iMD7w9d6gTdTlK5rwrdw9eU8JyrfxaHyUhDI8mHFvu71S CLKeMQSghyvSuZOE1/0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFZNQ-000oCt-Fo; Thu, 03 Feb 2022 10:30:08 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFZNN-000oBX-30 for linux-arm-kernel@lists.infradead.org; Thu, 03 Feb 2022 10:30:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1643884204; x=1675420204; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=1TXPyy/kpZBNxO1tbtGx3iBoVnJzfJ227qS4/tBvr18=; b=GiL4zXhIZu84Vs3IpMf+5H5qpocUQHi5jxr2I5M0Xn6NXeUSSI4+esLV A06uLrhzHQgOjejSI/G42hhwsWBoYvfQcqHm3UaNyixepsxF0m2UbJCAP gAX/t4rvCp5e9ewqWUMpCTG0eun1D9Hbs8+Q+VBHfUHMvG6TMnqkCv+hP y/jpXW1+HXUD3YoXOOmuZ9o4n8kkecmS4UDoG4mUptSHF083zVIoiaLOz 7+SR8WwvdXZSW1qHBSVQu/UcjEFAx8U2kIN+q2QlVU+HJ63n7AY0+EdYh IMDHoS6gpQY+YtPMBeub6z0cnR2hPH7BDJ27piGNQ+QRstvJFjLFKt7/T w==; IronPort-SDR: KptEahQXKMdnpFose7f1Df66KQBgN5k2e7W95KLW+AC4ubFgizza4MgTI+t5MrZ24ksmbfM/w1 F68uLGKNQG6XHcStLBz+aPNh7uL5GEAtdkYyqVjYOmE6ca+EP42zwUSWue4JN9rPA7DHGLuugo LJWgr4dp/Z4NBtlHxGRml6/x9DVELeVMXtxm5h0XiHG2fnTs+oQVQUTAej+OccO7oxIxNY0QWj hLS8s1OkI606jg6a4WaC/Rkg81utatMXOWKT7J/cKPt1f1yyrd9D7I3RdG4n0Ydag2ut8pLOzP xwO4ms0GBCABQaEFHUvGAKYw X-IronPort-AV: E=Sophos;i="5.88,339,1635231600"; d="scan'208";a="84547385" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Feb 2022 03:30:00 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Thu, 3 Feb 2022 03:30:01 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Thu, 3 Feb 2022 03:29:59 -0700 From: Steen Hegelund To: "David S. Miller" , Jakub Kicinski , , , , CC: Steen Hegelund Subject: [PATCH net] net: sparx5: Fix get_stat64 crash in tcpdump Date: Thu, 3 Feb 2022 11:29:00 +0100 Message-ID: <20220203102900.528987-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_023005_219942_54BCC251 X-CRM114-Status: GOOD ( 10.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This problem was found with Sparx5 when the tcpdump tool requests the do_get_stats64 (sparx5_get_stats64) statistic. The portstats pointer was incorrectly incremented when fetching priority based statistics. Fixes: af4b11022e2d (net: sparx5: add ethtool configuration and statistics support) Signed-off-by: Steen Hegelund --- drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c index 59783fc46a7b..10b866e9f726 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c @@ -1103,7 +1103,7 @@ void sparx5_get_stats64(struct net_device *ndev, stats->tx_carrier_errors = portstats[spx5_stats_tx_csense_cnt]; stats->tx_window_errors = portstats[spx5_stats_tx_late_coll_cnt]; stats->rx_dropped = portstats[spx5_stats_ana_ac_port_stat_lsb_cnt]; - for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx, ++stats) + for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx) stats->rx_dropped += portstats[spx5_stats_green_p0_rx_port_drop + idx]; stats->tx_dropped = portstats[spx5_stats_tx_local_drop];