From patchwork Fri Oct 29 11:29:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 12592527 X-Patchwork-Delegate: kuba@kernel.org 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 153A7C433F5 for ; Fri, 29 Oct 2021 11:29:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE56360E8B for ; Fri, 29 Oct 2021 11:29:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbhJ2Lbv (ORCPT ); Fri, 29 Oct 2021 07:31:51 -0400 Received: from mail-mw2nam10on2134.outbound.protection.outlook.com ([40.107.94.134]:11008 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231807AbhJ2Lbu (ORCPT ); Fri, 29 Oct 2021 07:31:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=leuE0IBIiGqvg4PoQs3gTJn0Xn3y4Wac3eSBYd7Ux+T3+2RS4IJGv1yv0Xdv/Nc4pYfeo5pUrEbHMixwHxfHEJJR1EEljCzWW7vAM1YAiy5O8WR1dBfxODJ54LCeMC85z4hH164htawb2j6/2qHKU3Ei62DV0mXffC3o7ROTldF4J1w8Hia7AgrH5mpC1jbGrmYzceYfgiuUwTqm9Kzc5RJyD7cZskOEMyTCYJVKvbwGhHEMvjNzgLt5dWyH5FS4aDsxJmoFEGEzksAbNg3MODysDSdAbb+M9xNAtbkobykiLxlKLYwDVZP7RKEDW4SP+jjvjsW5EKXFfYh5SCMJHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CKs1GzUL8/avXPIe8YBkoXOM8GTUHsRLDsBPsZCUDhE=; b=XytlWsfkxpQtZr3G07UYdHhzrCcpPS559uw2VBU8DQK3O+4h8pEOQyk1wPnqVtksMyNLpZjLqyhlk7spI+a69p0Jo/AkQ83iaEsH8GM3v/hTh3ecrPtsyl93m4uDp1vU8pY4Alm1KdX23wgcOve205RXoU1RPirALnBLAhuHkJfvjJ1o4YzH/zNJ46p2dcirz4BP4LxFJlnj4p7VgoLp5554MDRJKd9Kqv5dbVVh2U3FVBjIh8/K5f531kI3kz5cCDZ8kdCBr/es3IjhFLEURGkOlyrzquX3lxAL51qsgZYY6c3lg/l6AUveQgRhTvwTGdCJNtZKnuLkyE1k+1K+tA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CKs1GzUL8/avXPIe8YBkoXOM8GTUHsRLDsBPsZCUDhE=; b=dfwYpkA0mXM2gsTj8vXfWGBryCD83QUY8LLE0jPekGRh+dcOE/Use/0EBpCikczzpf7jMpyECIsevv6uMidQg3zK8F16vRpEXKWmKFd8dpC7JhmaeCjjnZByXTDITssegoYIK+HrRsCRDGqf+0yF0nBIzjdn8zqM+Mt+Ib+nebQ= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none;davemloft.net; dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by PH0PR13MB4828.namprd13.prod.outlook.com (2603:10b6:510:93::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.12; Fri, 29 Oct 2021 11:29:19 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::e1d9:64d0:cb4f:3e90]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::e1d9:64d0:cb4f:3e90%9]) with mapi id 15.20.4669.005; Fri, 29 Oct 2021 11:29:19 +0000 From: Simon Horman To: David Miller , Jakub Kicinski Cc: netdev@vger.kernel.org, oss-drivers@corigine.com, Yinjun Zhang , Louis Peens , Simon Horman Subject: [PATCH net 1/2] nfp: fix NULL pointer access when scheduling dim work Date: Fri, 29 Oct 2021 13:29:02 +0200 Message-Id: <20211029112903.16806-2-simon.horman@corigine.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211029112903.16806-1-simon.horman@corigine.com> References: <20211029112903.16806-1-simon.horman@corigine.com> X-ClientProxiedBy: AM0PR08CA0015.eurprd08.prod.outlook.com (2603:10a6:208:d2::28) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 Received: from momiji.horms.nl (2001:982:756:703:d63d:7eff:fe99:ac9d) by AM0PR08CA0015.eurprd08.prod.outlook.com (2603:10a6:208:d2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15 via Frontend Transport; Fri, 29 Oct 2021 11:29:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f57261a5-abf0-4f8c-1900-08d99acf5945 X-MS-TrafficTypeDiagnostic: PH0PR13MB4828: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vs3nvlK2/Ffxc/a88DSFgV8runNN+e4giH/EB6Cv5DQbb/SwfVGgg2AOLpQ+nyzsPXF27gBDC3o+VUIW99WrK5yL+5U6WzYxicgxZpaADYEUgp4I7W6eVSH2Ow1GbohRZhS7fI6DAJJV/a+x8pPloJfand3VIZhl/JTWGX/kctjcXdM6FnqgLJeMT4BdXWSETsFtN77aHQu3tzuNsIxBycehy7SG0g8K1XrdiA17CweT5Uoav/HMa+8QL/zsBTfHJZrGQCsRLuw7Lqw3XXfLV8KK3xCjz+NCaPOGajhSdAZPQl+PnHSdXj5JkcG9VwkRYqhXW2bLZGVg4jZxth3DC4Lj1jjB9BHFqr3yjENjgrK1J6v6hWz9zYr2Q8/uEzKAG48TsKcwHcfeY6lYmOygB4GQ0CLm61A7WKwQ2ZwNL/alXhfcvSUWqK50y3ll0I03rd2l/+mstkaH5ciDm0ivqMasqOHBPcmedtDhjlmRkcrivX1kJET0/+3m43XT/ecHTq2ieeS99UJNv+XDlReHX14ajAu3VFb1u3hKgf9J1+U5g+GnjTLRB4aZTEwrDPTR2Y15N13ISEtyJkoYU2+4c7NNuSNHTYKeYIquH0nbvvECDb1i606cvVsvSwFSHlZQ0RgnOWZWcFvdlcmffn9mKA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(39830400003)(136003)(366004)(376002)(66476007)(86362001)(4326008)(110136005)(107886003)(54906003)(2906002)(52116002)(6506007)(316002)(508600001)(186003)(36756003)(83380400001)(66946007)(1076003)(2616005)(6512007)(8676002)(6486002)(38100700002)(5660300002)(44832011)(6666004)(8936002)(66556008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NmTHEXIppjHNE6HD506x9bGKu+u1iuEs4Y0g1Nd7PGkykug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cF2rZH98Ch/QhkY4w9eJhGfNUoB2Bz8rjK2PvQjq2nFrmEDqwYYLh6DkfQFitg9EZgLBhVKscTDmClDvEKJOXEnnqknnoUvsDs1MiiTid/01jOodgkPME00RyZCenTPJkJze85WcUMnVZRsRWpz6OPuE6X4UrtrUh5Cp5Q8di84YbIswzMSgDl63B22uvzAMb46GkVYflUaO49vdqQ4ihtdpnbAqvDtnB38HEme+glyAzqqg+HiQccxDess6wwuyqtvgWBK/iv0rl7fOpIWcKsCeptGJX/xgC2GQXJpC2Bb0ilzKVkGUSA8oUU4lOhxzuYjjuzseXZpc4YQx3j2cz8OcbXvvtFLF0lQ5uJAnuJ2PkVOB8OM2gRcbuD8A4RsRfacZ6O75LrA/vcn6DKzqQTMPIHHoXr7HtvdVkaS29d/XijdnpwN2TC10xcL8010jMzYIpJgG3dXXL4RPDpo9VammI638hSe4LfaVidLVGnF2W7EgjNiAywQEP4PNgW62dotn8IZmXIP5DgXwYduImYR52UIj/y18PHz49U3mzWe5bOD5ELRYQ2WqVPJj9OLTBYiX0fxyCBZttJRMMVE31/gH+rIYJroKdZ/Vw+dLaILw== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f57261a5-abf0-4f8c-1900-08d99acf5945 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2021 11:29:19.7229 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: m9JmGxF9jUrA8E+X5ul32vVYfAlAPN2NBmG2HbgXKMObdqPxybqmNf1VHFldZ/1AVBdJNbMZgPyUyaSt+Kxd1q61rOn5M7g2BwTNrJ5zzps= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB4828 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yinjun Zhang Each rx/tx ring has a related dim work, when rx/tx ring number is decreased by `ethtool -L`, the corresponding rx_ring or tx_ring is assigned NULL, while its related work is not destroyed. When scheduled, the work will access NULL pointer. Fixes: 9d32e4e7e9e1 ("nfp: add support for coalesce adaptive feature") Signed-off-by: Yinjun Zhang Signed-off-by: Louis Peens Signed-off-by: Simon Horman --- drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 5bfa22accf2c..f8b880c8e514 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -2067,7 +2067,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) if (napi_complete_done(napi, pkts_polled)) nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); - if (r_vec->nfp_net->rx_coalesce_adapt_on) { + if (r_vec->nfp_net->rx_coalesce_adapt_on && r_vec->rx_ring) { struct dim_sample dim_sample = {}; unsigned int start; u64 pkts, bytes; @@ -2082,7 +2082,7 @@ static int nfp_net_poll(struct napi_struct *napi, int budget) net_dim(&r_vec->rx_dim, dim_sample); } - if (r_vec->nfp_net->tx_coalesce_adapt_on) { + if (r_vec->nfp_net->tx_coalesce_adapt_on && r_vec->tx_ring) { struct dim_sample dim_sample = {}; unsigned int start; u64 pkts, bytes;