Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1143001iob; Wed, 4 May 2022 15:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6FrC6FNDWPfEaG9mv/gVm4SUxnyiJNa8uKt4vAwv6zv8E0NljQQs+6hXaDkRPqa5WjXaz X-Received: by 2002:a05:6402:1156:b0:427:f560:779e with SMTP id g22-20020a056402115600b00427f560779emr8642003edw.205.1651704639555; Wed, 04 May 2022 15:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651704639; cv=none; d=google.com; s=arc-20160816; b=h+vYmjhB1KkIhiVEKvfms1+HTn0YJXfLN6XLKZtuABcr3n8mOaE6CjEGLUWyvZkfAd PvqqvJQvxQg8nHAuiJUUfUdMOq61cQVYcdgcOn+dlF3oTRwGUtaiK8qhdFAqbGX0RQzS 0blFB/0AC1ZZKOPDacqnsO4AM8i7YLY8BC9m3r+Q2lbX4+LyH+ItGo9CPt1JY6fvMhEC vh/xHX9I6asLR7o2SlnXbDVidJgkW8t8TKExl9SxfHmDqFayAUTO6o54lxhPSWLswPDc toLDB+xBm809+HjGs+gQp7O+5nFkvrl/1UXG8FolCmhRtDMwosqJ728yiSq6PvwN347k OfDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VQAu3+ezCd0vqDRN1lU89/EvFXLmAMAceXG4nW6Az40=; b=wUcqFzTsjCOvGoT2GS0RidLXC1kKlkgO22/jOEEy4c1aCp0Rp0FwIClPeE6wkUhAXt Rutv1UI7sE/WlCxcqeUrs0fxV0RdyAPrXJro5/iK4LHHWbKz7UroTvOOjnQpsgjx+ywX FvouvvIkoIlb16u97ex9YYQzJYByDEb/1OCdDXgvr3f+YjF8sPgGSh5xcI1PT3iGpC2Q kNUOO293J1x7sP8KBKQLkQ6pAPZSmZc5SEPlqzsINtqI04Gq/herLQNRkwko1gAzENpo d9ptvwz1Lo4M5nzOFwYc/oqhpqlXB/Vi584EZ71J7EoPnh4xqDyToV2HkfsU4QtoNF3A Gyhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iG5IiGhb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp10-20020a1709073e0a00b006f4408bfffbsi180494ejc.779.2022.05.04.15.50.16; Wed, 04 May 2022 15:50:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iG5IiGhb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356311AbiEDRS3 (ORCPT + 99 others); Wed, 4 May 2022 13:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356098AbiEDREx (ORCPT ); Wed, 4 May 2022 13:04:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25B855045B; Wed, 4 May 2022 09:53:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C13CFB82552; Wed, 4 May 2022 16:53:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F751C385AA; Wed, 4 May 2022 16:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683228; bh=A2o3xRMLahnM5/Rwk8Z3lvIF60qHPVcFm3ug6Q4zMXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iG5IiGhbEsR1YbvINW8cBXVJvK1baSIxct7c96D5HW9M8nQIYammYdZQbBFOeF0/4 YB06t7N3RfvCMv9cktvfwwacueW1gubRxCkXDYpBWNqsqPjlgJRAaIJ5dVgqFn0IzK tZ1rGMlxZ9CKAZ1j+e1G1Cc49KURMr2exXA2YLbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 093/177] net: hns3: clear inited state and stop client after failed to register netdev Date: Wed, 4 May 2022 18:44:46 +0200 Message-Id: <20220504153101.428868255@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen [ Upstream commit e98365afc1e94ea1609268866a44112b3572c58b ] If failed to register netdev, it needs to clear INITED state and stop client in case of cause problem when concurrency with uninitialized process of driver. Fixes: a289a7e5c1d4 ("net: hns3: put off calling register_netdev() until client initialize complete") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 16cbd146ad06..818a028703c6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -5092,6 +5092,13 @@ static void hns3_state_init(struct hnae3_handle *handle) set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state); } +static void hns3_state_uninit(struct hnae3_handle *handle) +{ + struct hns3_nic_priv *priv = handle->priv; + + clear_bit(HNS3_NIC_STATE_INITED, &priv->state); +} + static int hns3_client_init(struct hnae3_handle *handle) { struct pci_dev *pdev = handle->pdev; @@ -5209,7 +5216,9 @@ static int hns3_client_init(struct hnae3_handle *handle) return ret; out_reg_netdev_fail: + hns3_state_uninit(handle); hns3_dbg_uninit(handle); + hns3_client_stop(handle); out_client_start: hns3_free_rx_cpu_rmap(netdev); hns3_nic_uninit_irq(priv); -- 2.35.1