From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 3538C17AB5 for ; Tue, 20 Jun 2023 17:49:39 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 049C610F9 for ; Tue, 20 Jun 2023 10:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687283378; x=1718819378; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SLAjhiJl2DI/1hCKlWSkaXledA13ruzJScqm+J30Aks=; b=XzAucDe6dY/QNpjRds159U27GWLgnS2Q5NGlWprLdb2oUReRJOz4lkYN S69n2c6oWjgl2TyQdX+dXTAmdVIhdw9J9eM200LvX2XEmiZ5WmgnPKsbY gxG/e2XocK7dRNPL9Qv5l0r+B/gLluFC3hdgUHtNuOU8d6qIsgcdko92v ApQSWSqbF5j4ekPMWjnGEcGNpa5pmY/h5/5P2/RR9fyL3yI9Hoy/ao4Nb BnX8b9aL0IOmUpIA4hpznXx66ZuH75J7c8YObwDSVic0WuCMSgDECPByP kuHKly0ps/gRWTcIWSCnvR4f5aim1stRlK2L7Hbj3QAGethKgBpNXBEIp g==; X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="339554269" X-IronPort-AV: E=Sophos;i="6.00,257,1681196400"; d="scan'208";a="339554269" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2023 10:49:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10747"; a="838300574" X-IronPort-AV: E=Sophos;i="6.00,257,1681196400"; d="scan'208";a="838300574" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orsmga004.jf.intel.com with ESMTP; 20 Jun 2023 10:49:35 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Wojciech Drewek , anthony.l.nguyen@intel.com, jiri@resnulli.us, ivecera@redhat.com, simon.horman@corigine.com, Paul Menzel , Sujai Buvaneswaran Subject: [PATCH net-next 03/12] ice: Don't tx before switchdev is fully configured Date: Tue, 20 Jun 2023 10:44:14 -0700 Message-Id: <20230620174423.4144938-4-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230620174423.4144938-1-anthony.l.nguyen@intel.com> References: <20230620174423.4144938-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Wojciech Drewek 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 --- 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 be5b22691f7c..15a4c148c28b 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.38.1