From patchwork Thu Oct 13 07:21:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 13005708 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3BC3C4332F for ; Thu, 13 Oct 2022 07:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbiJMHVK (ORCPT ); Thu, 13 Oct 2022 03:21:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiJMHVJ (ORCPT ); Thu, 13 Oct 2022 03:21:09 -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 C07B5EB756; Thu, 13 Oct 2022 00:21:07 -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 CC2BA616DB; Thu, 13 Oct 2022 07:21:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB9B5C433C1; Thu, 13 Oct 2022 07:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665645666; bh=4Qg/4YlRRt7iol1x7LUDGs9R5uxzJP8b7ENofNmE/DI=; h=From:To:Cc:Subject:Date:From; b=oWSBG0s4B1XMobz5kBptwR16cM43AD+TQP/SfojdpdnMp2aGcLYeqFA3dp8r7++xu pj9DdMsonfZWCEQ59RH1Ixjs/+HHDNw9MtKXGUh7hmmEW/YmT6aac6bi7InNhLQZvt uIjBfQaln8c+fIvlAgM6z7oK0P3CS5nttJBkwHh1Etq5U+s10pqMWJu9tYPJYMo8xb f+FxybFYJ2IxTvS3ZOTHYWvd54u8WNMoc6XHz+3Fzc/x3z3yWuPeq9NOaB8lzaEfO2 BEni37BdMkoQxjugmI83UYANEHbqNmhaaTDKvCLgVEwiaUtv2UX8OLXo0w2QbDiHnX 41MjgDEbCJ0Xg== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Dan Carpenter , Emeel Hakim , Eric Dumazet , linux-rdma@vger.kernel.org, netdev@vger.kernel.org, Paolo Abeni , Raed Salem , Saeed Mahameed , Tariq Toukan Subject: [PATCH net] net/mlx5e: Cleanup MACsec uninitialization routine Date: Thu, 13 Oct 2022 10:21:00 +0300 Message-Id: X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Leon Romanovsky The mlx5e_macsec_cleanup() routine has pointer dereferencing if mlx5 device doesn't support MACsec (priv->macsec will be NULL) together with useless comment line, assignment and extra blank lines. Fix everything in one patch. Fixes: 1f53da676439 ("net/mlx5e: Create advanced steering operation (ASO) object for MACsec") Reported-by: Dan Carpenter Signed-off-by: Leon Romanovsky --- .../net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c index 41970067917b..4331235b21ee 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c @@ -1846,25 +1846,16 @@ int mlx5e_macsec_init(struct mlx5e_priv *priv) void mlx5e_macsec_cleanup(struct mlx5e_priv *priv) { struct mlx5e_macsec *macsec = priv->macsec; - struct mlx5_core_dev *mdev = macsec->mdev; + struct mlx5_core_dev *mdev = priv->mdev; if (!macsec) return; mlx5_notifier_unregister(mdev, &macsec->nb); - mlx5e_macsec_fs_cleanup(macsec->macsec_fs); - - /* Cleanup workqueue */ destroy_workqueue(macsec->wq); - mlx5e_macsec_aso_cleanup(&macsec->aso, mdev); - - priv->macsec = NULL; - rhashtable_destroy(&macsec->sci_hash); - mutex_destroy(&macsec->lock); - kfree(macsec); }