From patchwork Fri Jan 9 11:14:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5599001 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 E0EE5C058D for ; Fri, 9 Jan 2015 11:15:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F693204E1 for ; Fri, 9 Jan 2015 11:15:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37486204DF for ; Fri, 9 Jan 2015 11:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932632AbbAILOx (ORCPT ); Fri, 9 Jan 2015 06:14:53 -0500 Received: from mail-wg0-f42.google.com ([74.125.82.42]:51605 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932263AbbAILOv (ORCPT ); Fri, 9 Jan 2015 06:14:51 -0500 Received: by mail-wg0-f42.google.com with SMTP id k14so7512692wgh.1 for ; Fri, 09 Jan 2015 03:14:50 -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=wEPWxEK7RLeRPWw1Ym13n2FwPA8VDv39RECFOASZS6o=; b=PAqJ/a1zYyuUQnilhJ3Kcn1HjYlfDvw5dTtGOi4cqskvzdpWEnv226STCyX8dAvL+C qHu2Ofrya4UTG4K5a+W5yFen60YsVfuTboaCJP4blxUUbBehKoTHsOS/BxBFPuicWgoc ysVfqr+06ntavkWyAGQIysd+9/Ur5Ozd628SE= 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=wEPWxEK7RLeRPWw1Ym13n2FwPA8VDv39RECFOASZS6o=; b=j47cfdJBlLr23I2vSe3F+LkWfIoU+8fB/8QCKnLc4G8N8bDWNOYOiNKEvMT4YCMJPP GUNnN9cDFlF8t0CsX7bCwIiOTS6WvrzjaGLUiO11TTJd4//I5+b31WZujYmF0CXyWzPW r8nSMPYh+yc2Ea2mBjZSf+YWDkeGU98nNhoY7nWF5JiMi8VGz31SU1uLXabdYwFiuXGM sl/JKp/n7D5QMP6c1CeEPOn0ntznxbIeJZjcRwAYGqmEw0TesJLBVc8DbFEUI1jS2lTl DPOLEbYv9dP5J45w3oSFf4QbdEVv0LcEo50LtzzdPA5RZ2dKZwRw5l1MLCCKovgAlblf Wirw== X-Gm-Message-State: ALoCoQnI4PKLLM8Uo9j9oV+OBYIq2S9JEk8Xyg77R7z5iBCvNslnN3Q0du25UuCpuV8cfpvlvvwwhSg7QClY0IOW4jpSb7G3t0bB4XK3o4GLAn9wmC8K5dBZAlXJCX/CIXJ11SYusA8w X-Received: by 10.180.206.229 with SMTP id lr5mr3967293wic.74.1420802089722; Fri, 09 Jan 2015 03:14:49 -0800 (PST) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id gb10sm9612608wjb.21.2015.01.09.03.14.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jan 2015 03:14:49 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [RFC 5/8] ath10k: protect ar->arvifs linking with data_lock Date: Fri, 9 Jan 2015 12:14:06 +0100 Message-Id: <1420802049-11962-6-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1420802049-11962-1-git-send-email-michal.kazior@tieto.com> References: <1420802049-11962-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 b175827..fed8cc9 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3283,7 +3283,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); vdev_param = ar->wmi.vdev_param->def_keyid; ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param, @@ -3400,7 +3403,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) { @@ -3435,7 +3440,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_wmi_peer_delete(arvif->ar, arvif->vdev_id,