Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp567686ybh; Tue, 21 Jul 2020 02:24:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh6NuVljcY4tP+FkyN9ZJT0oN0BM26U4Nv2XSVeS3JlQW99iYAxXFLSL30Hgwc2oaanxue X-Received: by 2002:aa7:da56:: with SMTP id w22mr26012869eds.124.1595323454514; Tue, 21 Jul 2020 02:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595323454; cv=none; d=google.com; s=arc-20160816; b=GHjIhJoWEVH80uLVcibfF+YupsajQc2rRiu30XaTBI2yr5PyqAsONzBlRBXOfg0roh 9mu98wuBz6/I+jiq51ZacNwp3Hm4Ck6f3PHEBA9u3FWs+swg28Ms9P3EhhbICR8eVfSw JMg1N4LzOQhbehq7ObACNMuiPwHNLvmUdGFYn42Z4wAjWR+Ez8Rn0c2uSn85uGWaYh39 dO/VM8MPex4HsyrOt0e1bKu5QY8SxGoJQ5zVQcLA0vzDUCF3v3LkwBW14usCo4yeGUUO n7dRPQW+Q6xiekfp//tzCQR+l9zciebNNWAyDfcqEVFD0dgtzBID319GtBbXiIBXWvrQ +ePA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Ca3bHu5yDLDFmfE8NwktlzItv4aXUzLGK2gj+i7trAs=; b=aXeY7unEL5r4n5PCdcTcSogJuM04JPR0jisiyrbdikSOQvUBFmgjHWyVwwXc5AFFkx T5gtCVnLIFnlojk2DIAAAtVBBz8gkZTHz1O7QI9Dos0TNEnGm1m8MlmvVJ9koYkzZGlm ZP2Vx1XRNI/l7at5aKkehYHJJWSF3BOqRJR6thEUHqy3uoQh7jhaHV92u2pHaYBdn8ip tH2xK2uJwBWhpQETo1udk/mUJXLaziRKes3QajsUNLom+s6cfp0WmES8BpkHUmzu+tfW GQw6mCvOGBR0GFrvOeCnkWXWmQqZanipsmBcqX1zgUTudXw8tr51n1PIPpnRD+4yUK9V /Enw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o21si11583437ejg.550.2020.07.21.02.23.52; Tue, 21 Jul 2020 02:24:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728996AbgGUJTv (ORCPT + 99 others); Tue, 21 Jul 2020 05:19:51 -0400 Received: from inva021.nxp.com ([92.121.34.21]:56062 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727048AbgGUJTd (ORCPT ); Tue, 21 Jul 2020 05:19:33 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 7376D200464; Tue, 21 Jul 2020 11:19:32 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 675CA20044D; Tue, 21 Jul 2020 11:19:32 +0200 (CEST) Received: from fsr-ub1864-126.ea.freescale.net (fsr-ub1864-126.ea.freescale.net [10.171.82.212]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 29294202A9; Tue, 21 Jul 2020 11:19:32 +0200 (CEST) From: Ioana Ciornei To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Ioana Ciornei Subject: [PATCH 4/6] staging: dpaa2-ethsw: destroy workqueue after deregistering the notifiers Date: Tue, 21 Jul 2020 12:19:17 +0300 Message-Id: <20200721091919.20394-5-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200721091919.20394-1-ioana.ciornei@nxp.com> References: <20200721091919.20394-1-ioana.ciornei@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We should destroy the switch workqueue only after deregistering the switchdev notifiers. Without this fix, we could end up with switchdev notifications on a draining workqueue and also with a lock up since the netdevice reference count is increased (in port_switchdev_event) and not decreased ever (since the workqueue did not run). Signed-off-by: Ioana Ciornei --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 83e6bd4a803b..9114437645a8 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1628,8 +1628,6 @@ static int ethsw_remove(struct fsl_mc_device *sw_dev) ethsw_teardown_irqs(sw_dev); - destroy_workqueue(ethsw->workqueue); - dpsw_disable(ethsw->mc_io, 0, ethsw->dpsw_handle); for (i = 0; i < ethsw->sw_attr.num_ifs; i++) { @@ -1640,6 +1638,9 @@ static int ethsw_remove(struct fsl_mc_device *sw_dev) kfree(ethsw->ports); ethsw_takedown(sw_dev); + + destroy_workqueue(ethsw->workqueue); + fsl_mc_portal_free(ethsw->mc_io); kfree(ethsw); -- 2.25.1