From patchwork Fri Jan 30 08:41:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5747681 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4F4F3BF6C3 for ; Fri, 30 Jan 2015 08:43:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76D8C20225 for ; Fri, 30 Jan 2015 08:43:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2B7B2021A for ; Fri, 30 Jan 2015 08:43:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759884AbbA3InC (ORCPT ); Fri, 30 Jan 2015 03:43:02 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:49701 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759807AbbA3Imy (ORCPT ); Fri, 30 Jan 2015 03:42:54 -0500 Received: by mail-wi0-f175.google.com with SMTP id fb4so1363059wid.2 for ; Fri, 30 Jan 2015 00:42:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FvEn9Iqr/mD4lCyDaGJn5N3MkGFXfA6dzHRTm5h/G5w=; b=aIlFvFPvpS8MxELtk0uwF7fyX28qv9qIkoJxKAE/Sl8/c/sKZ9PGe/mbi9nXsBTRi1 6d2RPtJtgjB4fskck4UVCdcavTxcPJS3QJr10zdhs876OQqRR67JtA46OstAZJZhwWpy 5o8RLVb4rmQiWkiuRWAOZ27e/U413mKf5hQhc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FvEn9Iqr/mD4lCyDaGJn5N3MkGFXfA6dzHRTm5h/G5w=; b=aaJSCgOcl6pkxG8o5M3twH5UzW2DSNGt5QoA1X7HEZP5DMzhrPw3awzZfgRwtQGWwK t+4AIaulwrtofhdSdMVBTTxDn+vQ2J8sIRi8rWkvnoJPyWfR6jLaq2d5dydNI1AHTwjP GRVCx9JMI9n8Rj9kG+TiKi/qwWC1XbRYH4AguYdEJ/p32XqGwkt8bFgSwmwN5DoFi764 Sx/qgnRpX5Cp/gKbpV9QfUX77B56y86Pfg6mrSI1Rh9z+0rbQgjXKD/YPLaAskdFa/Qz 4OoUe90nH5oT4XEquT2Zs9ZIOlbGrDGLdfzC6wG2et90HC94MI393oTZQvDznpnVCx85 1amA== X-Gm-Message-State: ALoCoQmVV3QQQ5ruyqRORY+WBgU8R68QXc/ER+/su7VcOykN2R2B/ZZ7ig+flMiKkWIxLH982iRxHg2lqbkTcuae+ZEWswpWj8uDb3+HG71VVJjkLu3MAPitcaKyvbywgN/aoxsOjQNL X-Received: by 10.194.172.227 with SMTP id bf3mr618758wjc.124.1422607368632; Fri, 30 Jan 2015 00:42:48 -0800 (PST) Received: from bob.homerouter.cpe (apn-31-1-134-151.dynamic.gprs.plus.pl. [31.1.134.151]) by mx.google.com with ESMTPSA id i3sm5884655wie.23.2015.01.30.00.42.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jan 2015 00:42:48 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH 4/7] ath10k: protect ar->arvifs linking with data_lock Date: Fri, 30 Jan 2015 09:41:24 +0100 Message-Id: <1422607287-12289-5-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1422607287-12289-1-git-send-email-michal.kazior@tieto.com> References: <1422607287-12289-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This will make it possible to iterate over interface list while in an atomic context, i.e. tasklet. Caller should still be careful with accessing arvif structures though. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 16fddc7..721b2ce 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3325,7 +3325,10 @@ static int ath10k_add_interface(struct ieee80211_hw *hw, } ar->free_vdev_map &= ~(1LL << arvif->vdev_id); + + spin_lock_bh(&ar->data_lock); list_add(&arvif->list, &ar->arvifs); + spin_unlock_bh(&ar->data_lock); /* It makes no sense to have firmware do keepalives. mac80211 already * takes care of this with idle connection polling. @@ -3452,7 +3455,9 @@ err_peer_delete: err_vdev_delete: ath10k_wmi_vdev_delete(ar, arvif->vdev_id); ar->free_vdev_map |= 1LL << arvif->vdev_id; + spin_lock_bh(&ar->data_lock); list_del(&arvif->list); + spin_unlock_bh(&ar->data_lock); err: if (arvif->beacon_buf) { @@ -3487,7 +3492,10 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw, arvif->vdev_id, ret); ar->free_vdev_map |= 1LL << arvif->vdev_id; + + spin_lock_bh(&ar->data_lock); list_del(&arvif->list); + spin_unlock_bh(&ar->data_lock); if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { ret = ath10k_peer_delete(arvif->ar, arvif->vdev_id, vif->addr);