From mboxrd@z Thu Jan 1 00:00:00 1970 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 9F0CCCE79CF for ; Wed, 20 Sep 2023 11:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234576AbjITLrE (ORCPT ); Wed, 20 Sep 2023 07:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234578AbjITLrD (ORCPT ); Wed, 20 Sep 2023 07:47:03 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39974CF for ; Wed, 20 Sep 2023 04:46:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86452C433C9; Wed, 20 Sep 2023 11:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695210417; bh=8X8PUmuqvKlyvdCF4I0D/XeGnxfQjwi6hJOkKO21fuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGYoqMRaZ/8vOHOLqcnvOhH73xGCmrE+ndFrX1nNKEIlRO+TkgbW4G8gfEPDOAvS5 M8bkHoqef6P0RlC1m6fmRoPCUX6bgsEVKoqIIqCs+JjHD6BhOKhNXmTm93jUmlLj8T q211fL4/ayw9ZLqyUBOxED8KGi8QDNMCspWOVlRU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Menzel , Simon Horman , Wojciech Drewek , Sujai Buvaneswaran , Tony Nguyen , Sasha Levin Subject: [PATCH 6.5 026/211] ice: Dont tx before switchdev is fully configured Date: Wed, 20 Sep 2023 13:27:50 +0200 Message-ID: <20230920112846.611183817@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112845.859868994@linuxfoundation.org> References: <20230920112845.859868994@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ 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 8f232c41a89e3..459e32f6adb50 100644 --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c @@ -331,6 +331,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