From patchwork Sun Oct 1 11:41:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Auhagen X-Patchwork-Id: 13405374 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B87DC9CA66 for ; Sun, 1 Oct 2023 11:41:21 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2117.outbound.protection.outlook.com [40.107.20.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68CE2BD for ; Sun, 1 Oct 2023 04:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VsLOUj6CaLXNIxLikLWCEqkzNQqbEBwZKa+sWeqCzoHt36t6v8eJr7l3J7P8HKAS9a/5ZUHgwm+9A8ywO+kp+Y/U4AHQF75wDukzh4MKahYQpuyd3u/CDoTl7vE3fiCFXYUgZp6cA81tiRcU1FFVg61BfjWZFyvZ/8/5F1agoBVLT5jxsp9cktk/eIQL2ynYkKaVtjc7aIGblwCw2eGCviNmq4nCma1Z5eFRtk2o4eK/wUCBbvlYgX/5F8vM+xsGJPtEy5vbbNfP8KsdOPQmNiQlBGWEeFr2WxDE2AZBFnQAmR5+zyR4d/H+tELZl7C275SfVX6MKPJgpNt8JBijEw== 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=Vhup2zizJRIr2ZUCCVdPbRY4T4koZmtvDIlj4lZXgHs=; b=oaU/NvThpEVny2FABBPWq8gkvMhMvuwo7c6uDgaA4yc8f5vaSmL50J6NuaNbTZQnTOeetEwI8gv5f8F+j6TVb4oX9uGwglBeOeJ/4eGk1qZtZ57kP33h9cmzo3KqsfLsquY9LfB+wZLEt5MtxGe9YXwzMKXG2A9tq3ObGWFmJv3/3J5RrQIwwhuTHhbJa41c6NrGD5bRCOscrHE2upA+vp4XY4fqD9vkSLndXsNe5Ru25nuqF6LsKViBrGbYlQ5VpJakW49kiDUYY+LvuCkjvVBGYL5T3Ce/ar7ABGxMleCDM3RML2ziLi28DmbYUzcUQ6+hQnl25NXq1Ax9L11JCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=voleatech.de; dmarc=pass action=none header.from=voleatech.de; dkim=pass header.d=voleatech.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=voleatech.de; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vhup2zizJRIr2ZUCCVdPbRY4T4koZmtvDIlj4lZXgHs=; b=JfwvkuVy2sojq+2+6cGkk3ZSrreGkGRDyD7Gg1CCr+25YaY/eHeUD3g0UGtI8fNxrHR7dRgkff3uBCQGKXPN/mPDQ5xiOkaU/avvdSUf67mybp37/XJLxq+YhnE7dhKJ0Qy0N3mYQrTirW9K08EwF6wZ4MlDsqGou7GtSzME8yU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=voleatech.de; Received: from AM9PR05MB8857.eurprd05.prod.outlook.com (2603:10a6:20b:438::20) by DU0PR05MB9679.eurprd05.prod.outlook.com (2603:10a6:10:319::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Sun, 1 Oct 2023 11:41:18 +0000 Received: from AM9PR05MB8857.eurprd05.prod.outlook.com ([fe80::fd04:c41c:d9cf:21b1]) by AM9PR05MB8857.eurprd05.prod.outlook.com ([fe80::fd04:c41c:d9cf:21b1%6]) with mapi id 15.20.6838.024; Sun, 1 Oct 2023 11:41:18 +0000 Date: Sun, 1 Oct 2023 13:41:15 +0200 From: Sven Auhagen To: netdev@vger.kernel.org Cc: thomas.petazzoni@bootlin.com, hawk@kernel.org, lorenzo@kernel.org, Paulo.DaSilva@kyberna.com, ilias.apalodimas@linaro.org, mcroce@linux.microsoft.com Subject: [PATCH v2 1/2] net: page_pool: check page pool ethtool stats Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR0P281CA0230.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b2::17) To AM9PR05MB8857.eurprd05.prod.outlook.com (2603:10a6:20b:438::20) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR05MB8857:EE_|DU0PR05MB9679:EE_ X-MS-Office365-Filtering-Correlation-Id: 69172017-da71-4d44-eaae-08dbc27353b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QQKYzQQJZhU7/O/FWVCMyGjB5QJ//a5JhoMm6uBkTAJckdo3xLXLc6IeX3OSYj5Y8lB2yj9g+s0KvjMey9AobFDu7z1e0B+M5FzjYCfr3JDWvUN6dRlhykOAOdrvbbQaObh+kzjeBKklfGz0BYr97XNpw3z6BVWXQcwBXAgVPiHBtOLp2SZG5T7jm1ZKkdboLNU/aVmHtRrqkVMRwpBMNe8bualh6q05UR5zNJ6WmnErP9h+stgsj3Gjx5UShaVpLJyNtQRZq2oR6W+qi1hhtZwkYDaAAc1q80R/uk0KVvWjzNto8hIyacGGKcDKAFckWwUBtnFO5jTRy+dGPgzR9dDh//S5/sZVYNhUMLBiWJv/39PFJEJPicrS3gTU5cHfRrXmfmH1OeO40DvcAYGcuKoPkHRnQjKrNjuyxkvF5BZEdDfHGgHc0WEDvJ6XiylzCh5yYn5KfnEQFl2VN20KUUtKDQyiw4C/fS7AFFr/lFN0SvggfG27BqN8IxUJ+CJ/VvJB4/jksOhlm/qXx8s9K8H1J4vFuuUNd1F3WB6u6eBUgBv8cJYjb49NhTIsYbWp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR05MB8857.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(136003)(376002)(366004)(39830400003)(396003)(346002)(230922051799003)(64100799003)(451199024)(1800799009)(186009)(4326008)(66946007)(5660300002)(66556008)(66476007)(41300700001)(44832011)(6916009)(8936002)(316002)(8676002)(2906002)(4744005)(38100700002)(33716001)(478600001)(26005)(86362001)(6512007)(6506007)(6666004)(9686003)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zY0+mMy9qHps3SzPky3xTORWEC0DBh68ym9roZTj3dZZLjg4VerA8+D4suUyLZxU+xeNQIUICk9FudmkG11Qa1NWtGl/Jy0n+71Caxdyr1OgaSVUIl/2eWQ2bBUScIiFMeJgN9lQDgrn3Ht6+mpKwKRV3gtEh1mgFSfPvlQ5+kTL2ffx0ZofQrgre1An1QEk+CbAqcFQif8xd/gBGx2c8UozCbUMcludK+f7EzMHb94gjaYQB1MPyWQFB8kzgES7Qls/J3581qg5foQYF/IYZlyv6XZN5BtR6dUAhfNP1gea8aUIQWPpKudPp7SKnyPYq/rEXN9vNE7TNp9irRU9g0y7ZNGJPwDc4kIu8STxCShwmCZFYxxdGhrl2i6UleQ54LlfhwMrCd/CraC5i3o0BPH4f+6aWoNl6VgwPCryzga7TohNoPoNZ9PC12GnNQ6FUzm9bZ/uL7xcMa4Q9exxtAL5LIHxz8P5ye3994RiUiNwP0Nwb+YkOb4ZARlEA5u5LS03Xv1eOEUApexgAMeOUv7gu/QdG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leatech.de X-MS-Exchange-CrossTenant-Network-Message-Id: 69172017-da71-4d44-eaae-08dbc27353b0 X-MS-Exchange-CrossTenant-AuthSource: AM9PR05MB8857.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2023 11:41:18.5425 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b82a99f6-7981-4a72-9534-4d35298f847b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t5mkpyAPTypgVVhIe+i/EVdVLJObnEQbUWf/JPz3NadhWP5+91U2P9bUAnjO5OFrawu/H3lgakVITvLAP59cY5dFLLoHDwhEx6PoW7bjKls= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR05MB9679 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org If the page_pool variable is null while passing it to the page_pool_get_stats function we receive a kernel error. Check if the page_pool variable is at least valid. Signed-off-by: Sven Auhagen Reported-by: Paulo Da Silva diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 2396c99bedea..4c5dca6b4a16 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -65,6 +65,9 @@ bool page_pool_get_stats(struct page_pool *pool, if (!stats) return false; + if (!pool) + return false; + /* The caller is responsible to initialize stats. */ stats->alloc_stats.fast += pool->alloc_stats.fast; stats->alloc_stats.slow += pool->alloc_stats.slow;