Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp179857ybc; Mon, 18 Nov 2019 22:54:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwN7z3pQo2YLcfhnnvqUDKFqUooknmKWWx4cccPOSklZNmSqEmTb4T47WwNiLI8XP8mR+yH X-Received: by 2002:a17:906:bc9:: with SMTP id y9mr32605813ejg.64.1574146476684; Mon, 18 Nov 2019 22:54:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574146476; cv=none; d=google.com; s=arc-20160816; b=AAvm+W+KwWTv3kkF/NVoqr+bIjrqHpFg8+j6ihFWG8uw1JsfAwGC3SVzAEzhQofquE l3dVOfXLIFppljOghd8YHqS6o7d1KwHupUYnPAycRDcP1QcwbXHSsqBOBgAgBvEn5gRJ 600yLT153t+7nkgqMYPjukpZrmABU9LGaxvbP5xeTrR3+dEmxldCLB23MhyVNdY8y2Pr bebXUnnAm2EHmO5SrD7JH0EdC6V3xOKH1dx+KqOWP/9y1NlWcr2xNtz/mb4AdlueuEsM 2lofqcSw2nOYhXXfViBIeJMsv5sDxjMaZGYSIdSwqVsMcNlPq8ULOKFWBUfEf+sEWTZm guBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0seATojm7HqzryOtzrG9Jt5pf69XVE4K0RfZ2iiTkMw=; b=RP8W1mVHSAWzJorknSXvjwo57yjC6xaEBjMd0sMiFErzt6QXtobXNF6cx5R9Id43X3 rUF52KRdopnl3qd5nSCU67S111JpF4ewwI04v8A4NOUH23gf6/Rz6oxd2GYZV4Ka86h2 p+8ixulMafJPelCHaCRRayhhDi5evKBJjHomFnWFRqsloBZy9YYxc+nWOfQZdaEAt8rB rLffvtDfFhZx5LV3ZPkXTm3N/y6OUlTrreMEztXVWvwMYswoUvGNIefASQp6J4V/pWse 92gg+G9iosAUK4SUSig/BJ+QBy8N5Y0ZC1QCuBkG70e+xRp0hB1AP9lmKfktPtXYFGpH 4Zgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2MM8K+ME; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m33si14663698edc.126.2019.11.18.22.54.12; Mon, 18 Nov 2019 22:54:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2MM8K+ME; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731493AbfKSFvn (ORCPT + 99 others); Tue, 19 Nov 2019 00:51:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:49158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731821AbfKSFvk (ORCPT ); Tue, 19 Nov 2019 00:51:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 21317214D9; Tue, 19 Nov 2019 05:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142699; bh=pfDF5o5Sf/FZB9G8qxf3rgn8Br81z+BJhC63kU1YSUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2MM8K+MEbxwPIK3Hn8EaifFOihgiDbRmkhPHHdxK2XJmyzTjGbuPYrH/rzuF4tp2l y6V9OJ48T638xv5gXsRvjUBsLJ+KsMwQd5MhSsrmwa2iEXrj9nh8B570Nr9t26TPWY 9uevkNAiTv3tyZBT7IC/Uty0o2rv52+EFcrEenQ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 129/239] ath9k: Fix a locking bug in ath9k_add_interface() Date: Tue, 19 Nov 2019 06:18:49 +0100 Message-Id: <20191119051330.569269677@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 461cf036057477805a8a391e5fd0f5264a5e56a8 ] We tried to revert commit d9c52fd17cb4 ("ath9k: fix tx99 with monitor mode interface") but accidentally missed part of the locking change. The lock has to be held earlier so that we're holding it when we do "sc->tx99_vif = vif;" and also there in the current code there is a stray unlock before we have taken the lock. Fixes: 6df0580be8bc ("ath9k: add back support for using active monitor interfaces for tx99") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 3589f1f3e744d..72ad84fde5c18 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -1250,6 +1250,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, struct ath_vif *avp = (void *)vif->drv_priv; struct ath_node *an = &avp->mcast_node; + mutex_lock(&sc->mutex); if (IS_ENABLED(CONFIG_ATH9K_TX99)) { if (sc->cur_chan->nvifs >= 1) { mutex_unlock(&sc->mutex); @@ -1258,8 +1259,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, sc->tx99_vif = vif; } - mutex_lock(&sc->mutex); - ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); sc->cur_chan->nvifs++; -- 2.20.1