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: 5790111 Return-Path: X-Original-To: patchwork-ath10k@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 E25439F399 for ; Fri, 6 Feb 2015 12:04:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E101201E4 for ; Fri, 6 Feb 2015 12:04:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D71D201C0 for ; Fri, 6 Feb 2015 12:04:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YJhe1-0005ME-Ca; Fri, 06 Feb 2015 12:04:21 +0000 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YJhdx-0004yh-Si for ath10k@lists.infradead.org; Fri, 06 Feb 2015 12:04:18 +0000 Received: by mail-wg0-f41.google.com with SMTP id a1so13167192wgh.0 for ; Fri, 06 Feb 2015 04:03:56 -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=FthkK6MHx7/vKYu4UYR07Hddj7RLCY9iCg67gOGns36kxC7OgVTfdrAXYF37SVeIgr y7/47p5E0SKrxHIgVQwqMh6oeH0sn3hZ5PywieUF7ffT5AUISjtkS8WFMPtjTYB/ncad LkE99LF0AraHIMxB2vE4OXn4m+Qko3J8WGU4OH1iHbf055MQH7no5l2P59J5jIPMVIgP 0DORDC9MglPORvydaodGO0qgPfnFZCHIkVRGzjuqUn5M1NBQ6GRqJoI+aX8LCKG2QHUF 9TfWWlCJJ56mCrJabqYV85qESfjcnCt89A0XK8MsJhMnzsNurKNUtdI1IV9aKQoFX0JD SCAg== X-Gm-Message-State: ALoCoQnzoWqRExnzN3gDs6sgezgY5zNp3H43pyHCj3k/RhaTFRZ29SwopiPChJL5uEOUhFBwlszqtas7QKd9Xw5vVdE9ui7qh7xdrrBi09K6IgUKXfm2Y316TRborArCXROXv1UKAwVy5yggm6gGWBRorkyc47I3hRVxLt5U9dL0utxOEWGdJV0= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150206_040418_081162_7F0C404C X-CRM114-Status: UNSURE ( 7.53 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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);