From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0826B33EC for ; Mon, 16 Jan 2023 16:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82EBEC433EF; Mon, 16 Jan 2023 16:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673884824; bh=qOzE2rdgDEjww2U45Lpa/1Y9HN4a1OLAOf7LIffXDmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T5Mg+o5I78zMkpPXYyoWXwDK8EPxOhR3EFQqJiPRY32kQDNEP7Pyz9W/+GUceV9CI N5u22qkBzetss9PWzsTxGgFkNVAgFXg/W3kWOgTrd9+NMs1MTk0ybBdGNZz1YYPgGw y4eQF0MRFjlcvnuYn398f4r/DoyAYKW547QTu7GI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Roy Novich , Roi Dayan , Saeed Mahameed , Sasha Levin Subject: [PATCH 6.1 153/183] net/mlx5e: Verify dev is present for fix features ndo Date: Mon, 16 Jan 2023 16:51:16 +0100 Message-Id: <20230116154809.785183168@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154803.321528435@linuxfoundation.org> References: <20230116154803.321528435@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Roy Novich [ Upstream commit ab4b01bfdaa69492fb36484026b0a0f0af02d75a ] The native NIC port net device instance is being used as Uplink representor. While changing profiles private resources are not available, fix features ndo does not check if the netdev is present. Add driver protection to verify private resources are ready. Fixes: 7a9fb35e8c3a ("net/mlx5e: Do not reload ethernet ports when changing eswitch mode") Signed-off-by: Roy Novich Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 951ede433813..4dc149ef618c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4071,6 +4071,9 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, struct mlx5e_vlan_table *vlan; struct mlx5e_params *params; + if (!netif_device_present(netdev)) + return features; + vlan = mlx5e_fs_get_vlan(priv->fs); mutex_lock(&priv->state_lock); params = &priv->channels.params; -- 2.35.1