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 623BC15ADF for ; Fri, 8 Sep 2023 18:18:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82A11C116AC; Fri, 8 Sep 2023 18:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694197093; bh=2moswtduosVbZCi0XcHr4sw4xQU3JElaiZvKOBG6Qis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fudkfAr0b7UQ2bclaDvffGKVpw8ztgqx0DEhp3x0BQDhpFDZB1iga4yj7SaQA9rXp MO7x4aaPHhOaVEQcprPXnEx+WEiRwkdJoLCoC5hfG6oJ07tGgUlrpp5qbw2r/zElcQ X9H8JPtTUVyWRZO7KVaCNXhTPdslRiXTI/az1ywY9yj0BBjIm8Xw2TssHf4PCdygtL p1mDTT5+OHfEQNxgqphqXUVaKeLeUVIZG9h7zo4tCYC09wCfoGjcqJ35J7hhBcSoS7 c/uxZ7qlwzTveS2kjP/OnU7BaIxY0GEpnfN+73YP1EUsw6+GLe8JUhKNW6PtFWuVop fiO97IIN7ovdw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wojciech Drewek , Paul Menzel , Simon Horman , Sujai Buvaneswaran , Tony Nguyen , Sasha Levin , jesse.brandeburg@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 03/26] ice: Don't tx before switchdev is fully configured Date: Fri, 8 Sep 2023 14:17:41 -0400 Message-Id: <20230908181806.3460164-3-sashal@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230908181806.3460164-1-sashal@kernel.org> References: <20230908181806.3460164-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.52 Content-Transfer-Encoding: 8bit From: Wojciech Drewek [ Upstream commit 7aa529a69e92b9aff585e569d5003f7c15d8d60b ] There is possibility that ice_eswitch_port_start_xmit might be called while some resources are still not allocated which might cause NULL pointer dereference. Fix this by checking if switchdev configuration was finished. Reviewed-by: Paul Menzel Reviewed-by: Simon Horman Signed-off-by: Wojciech Drewek Tested-by: Sujai Buvaneswaran Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_eswitch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c index 2ffe5708a045b..7de4a8a4b563c 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c @@ -361,6 +361,9 @@ ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev) np = netdev_priv(netdev); vsi = np->vsi; + if (!vsi || !ice_is_switchdev_running(vsi->back)) + return NETDEV_TX_BUSY; + if (ice_is_reset_in_progress(vsi->back->state) || test_bit(ICE_VF_DIS, vsi->back->state)) return NETDEV_TX_BUSY; -- 2.40.1