From patchwork Wed Mar 10 19:03:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12129097 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F8E1C433E6 for ; Wed, 10 Mar 2021 19:04:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5049564FD0 for ; Wed, 10 Mar 2021 19:04:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233679AbhCJTES (ORCPT ); Wed, 10 Mar 2021 14:04:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:44300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233723AbhCJTDz (ORCPT ); Wed, 10 Mar 2021 14:03:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB8BB64FD3; Wed, 10 Mar 2021 19:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615403035; bh=vWKCxkdlG/VxjJdSvPNM52aYuPBtHXpYMFFydwDAf8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PseMnWMoZsSMe+WkdsChB4rmTykCe6YjoNvruKLAZDZZt2Hu/17PUeSdkh///hqR8 Ia3ckTlo8SgT4rdxo5v2vcfb1jVYe8iIsNauFlqp+og0fhuxp7kP+n2jOXedyzPTzJ 2M41+kZZG7KoqWQdj3gem6UX1KckEjRQm4QZsDGDUFagDUgpfWpNzuZEu+rgJMkugo AzWX1Q9QlErzodKhAhZwYV6Sxnvwuu1oT6tTVn009fDkS6MTZBuTpdHChWZ+i9ZscX cTbtkUUr52VxoXnZkn9ES66qsq38figwSMfamttJ/HPNZoe9pREkO5nsUxKEwKCJ/5 pKzsQ/k3P+hyw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Aya Levin , Tariq Toukan , Saeed Mahameed Subject: [net 04/18] net/mlx5e: Set PTP channel pointer explicitly to NULL Date: Wed, 10 Mar 2021 11:03:28 -0800 Message-Id: <20210310190342.238957-5-saeed@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210310190342.238957-1-saeed@kernel.org> References: <20210310190342.238957-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Aya Levin When closing the PTP channel, set its pointer explicitly to NULL. PTP channel is opened on demand, the code verify the pointer validity before access. Nullify it when closing the PTP channel to avoid unexpected behavior. Fixes: 145e5637d941 ("net/mlx5e: Add TX PTP port object support") Signed-off-by: Aya Levin Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 9e2a30dc5e4f..66d23cd275c1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -2503,8 +2503,10 @@ void mlx5e_close_channels(struct mlx5e_channels *chs) { int i; - if (chs->port_ptp) + if (chs->port_ptp) { mlx5e_port_ptp_close(chs->port_ptp); + chs->port_ptp = NULL; + } for (i = 0; i < chs->num; i++) mlx5e_close_channel(chs->c[i]);