Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3942118pxj; Mon, 21 Jun 2021 09:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQi2bcY8pdR70smrpCoeCxGwWowL5TFzJSWPro86h3DWwMNLJhgZ8CtkiMwlh9EbzOxmqr X-Received: by 2002:a05:6402:4396:: with SMTP id o22mr22582727edc.15.1624294317275; Mon, 21 Jun 2021 09:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624294317; cv=none; d=google.com; s=arc-20160816; b=y88pPXEt5/Q0NWRdPKYYfMVX3ZSHXMrt8T39KDBQLtMC3uogpVQxn/0MLy4yLUq02F 4Up5lzAKCRCBpb4rzX1qBReUX3GPvGR6qP8886w6XWzX1/3laIuBdPSgNTCi+K5yfVVR psLSZnIbe+oke9IgTJjSFer6IE3RKeLCx/KEGv+aPBFfaYgQz6/YfZevGICXI5wczpaN 07CrVPi+ciMf6x74GCelB0qvr2Yig8ejoOaj7gsBHT4L/D3I1nsmQYafMXyKhIoZa+nq T4v2w6iUbqCS3zpoA0NaTjQr6X5GxxkVb1QKA5Ap6FvYPNAMpzS1dVnissIP0tLz8vI2 hjCg== 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=DpzV130uPfRK4bmSGBBQxt7dVPtO/FL3qMgbKwdBYVs=; b=UiKuhluTJ1NtRp0aT8OazPrLRgpLAda7ufH+FBzxJ90aj8N+yLlILE0H2ylJgYDIOe hIxZi39oI+ugiaf3LVrIcnSRjwecD5wCf5QGeF0dpkca7hUbpCJqBflSYpORGwGlFJAM L4ac1fsOvYc1YcxnxIrU5BNZx9ppihWKWUcumJVwOxjtDmldWgoLisWrHZSv7uDgxRnw 0BqmVQ2GQFGZAuo1bhm0pEufqYZYs7PQm93ImWph5dFyx25xsdm6jhoBE4hSN1LGxEY+ ECn2Umh4IN+XJ6Lwt96GEDedLI9j/8dy9khKApx2HWm+hX5aTR0R8jayE06ucILgv5Xg ZakQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6bDhp6f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hw6si3400553ejc.395.2021.06.21.09.51.35; Mon, 21 Jun 2021 09:51:57 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6bDhp6f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231815AbhFUQw4 (ORCPT + 99 others); Mon, 21 Jun 2021 12:52:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:37918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232959AbhFUQtG (ORCPT ); Mon, 21 Jun 2021 12:49:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1498C6141C; Mon, 21 Jun 2021 16:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293257; bh=5lK8PQzOoaZALFIJTkUp2xLa/ULEdSHdXhaBN6lQozQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6bDhp6f0UkS0/zoOvm3NfTe3i+RH2qM2ThXs2yWxCA8cqQmiF62vH8dz7TdKSlhp maR9KAd3h+wjEF6mMeCVyhp1RthZs6PS5j0xZxsWguHEmvBC7T22fTKuTD2ZvhThKv 8QX4L39bLH+2G0wkky0AD5LpmURFHTLZH24TeAv8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg Subject: [PATCH 5.12 156/178] mac80211: move interface shutdown out of wiphy lock Date: Mon, 21 Jun 2021 18:16:10 +0200 Message-Id: <20210621154928.062449324@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg commit f5baf287f5da5641099ad5c809b3b4ebfc08506d upstream. When reconfiguration fails, we shut down everything, but we cannot call cfg80211_shutdown_all_interfaces() with the wiphy mutex held. Since cfg80211 now calls it on resume errors, we only need to do likewise for where we call reconfig (whether directly or indirectly), but not under the wiphy lock. Cc: stable@vger.kernel.org Fixes: 2fe8ef106238 ("cfg80211: change netdev registration/unregistration semantics") Link: https://lore.kernel.org/r/20210608113226.78233c80f548.Iecc104aceb89f0568f50e9670a9cb191a1c8887b@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/debugfs.c | 7 ++++++- net/mac80211/main.c | 7 ++++++- net/mac80211/util.c | 2 -- 3 files changed, 12 insertions(+), 4 deletions(-) --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c @@ -387,12 +387,17 @@ static ssize_t reset_write(struct file * size_t count, loff_t *ppos) { struct ieee80211_local *local = file->private_data; + int ret; rtnl_lock(); wiphy_lock(local->hw.wiphy); __ieee80211_suspend(&local->hw, NULL); - __ieee80211_resume(&local->hw); + ret = __ieee80211_resume(&local->hw); wiphy_unlock(local->hw.wiphy); + + if (ret) + cfg80211_shutdown_all_interfaces(local->hw.wiphy); + rtnl_unlock(); return count; --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -252,6 +252,7 @@ static void ieee80211_restart_work(struc struct ieee80211_local *local = container_of(work, struct ieee80211_local, restart_work); struct ieee80211_sub_if_data *sdata; + int ret; /* wait for scan work complete */ flush_workqueue(local->workqueue); @@ -294,8 +295,12 @@ static void ieee80211_restart_work(struc /* wait for all packet processing to be done */ synchronize_net(); - ieee80211_reconfig(local); + ret = ieee80211_reconfig(local); wiphy_unlock(local->hw.wiphy); + + if (ret) + cfg80211_shutdown_all_interfaces(local->hw.wiphy); + rtnl_unlock(); } --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2186,8 +2186,6 @@ static void ieee80211_handle_reconfig_fa list_for_each_entry(ctx, &local->chanctx_list, list) ctx->driver_present = false; mutex_unlock(&local->chanctx_mtx); - - cfg80211_shutdown_all_interfaces(local->hw.wiphy); } static void ieee80211_assign_chanctx(struct ieee80211_local *local,