From patchwork Fri Feb 6 12:02:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5790071 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B25769F2ED for ; Fri, 6 Feb 2015 12:04:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9755200E6 for ; Fri, 6 Feb 2015 12:04:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25487200DB for ; Fri, 6 Feb 2015 12:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932143AbbBFMEM (ORCPT ); Fri, 6 Feb 2015 07:04:12 -0500 Received: from mail-we0-f172.google.com ([74.125.82.172]:43537 "EHLO mail-we0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756422AbbBFMDz (ORCPT ); Fri, 6 Feb 2015 07:03:55 -0500 Received: by mail-we0-f172.google.com with SMTP id x3so7700719wes.3 for ; Fri, 06 Feb 2015 04:03:54 -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=SenotWYFuGEXteLqwu30ndlxGhup0WC4nlb970H/d1w=; b=bRMZ1nAKY+dYtBGxCM1rddXDfbkroKFGYj6Ok0iAULUSL4VfRo2WrHA2piASyzYJ5u tdTBILtrKEqMSGevUJTB3wRoFdFKQe/oANcFQV/vU7isyqdVR/Bz5EyCxerUS85BvWO6 VCLA22+zWeIDxBu0hMfZ5Dw1SFzIEZEmutYTg= 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=SenotWYFuGEXteLqwu30ndlxGhup0WC4nlb970H/d1w=; b=FKY/IdYd7qNuoz9vi6TYqT7q9uu2SaRha2hYJ0KRiv/zsX9+neDHVAhbvufWfVocRP C1n6oKrYLGh5xAs2Vi1iIvnlrjTreJsVRh100ORLSHbnQY0ROliANRaaEBwczNxTT4PO DYQRwEmsEiHvodM9IfyYGlF0+T7d0cDqwhWzMVeVTjbDF/Ik3d9VuFy+bPN34ckbPbd3 ypWxJ/Kv2GJq2zTWf8v2Ybhs5eZQDyyJdu7HArwzPyMwkhVoPN26NqkurkWiI9SH+l+e z4VAYmq5GF9+Nfvpysz7/jVDYYB7Vj0GzqBWXONO6AmwStVTzHjnOQebC6Mawigf898U DWCA== X-Gm-Message-State: ALoCoQkimncilDmSI4+qOnXEbE7b5/519hlPUfBQItzEZM7zmdu0SxRzRLHIZaEIcniUj1jCtmHN82ZydbBtZg1TaNmALU+f1qk9I0R26migsyn6qt8GPWDD3CwG78a5lEyPRVjp611t X-Received: by 10.194.23.39 with SMTP id j7mr7018725wjf.9.1423224234029; Fri, 06 Feb 2015 04:03:54 -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 kj8sm3070158wjc.29.2015.02.06.04.03.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Feb 2015 04:03:53 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH v3 4/7] ath10k: protect ar->arvifs linking with data_lock Date: Fri, 6 Feb 2015 13:02:51 +0100 Message-Id: <1423224174-24764-5-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1423224174-24764-1-git-send-email-michal.kazior@tieto.com> References: <1423224174-24764-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 2348f8b..1d7e0ae 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3314,7 +3314,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. @@ -3434,7 +3437,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) { @@ -3467,7 +3472,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);