From patchwork Fri Jan 30 12:31:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5749581 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 1C0A89F302 for ; Fri, 30 Jan 2015 12:34:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1FEC202AE for ; Fri, 30 Jan 2015 12:34:06 +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 D947A20279 for ; Fri, 30 Jan 2015 12:34:05 +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 1YHAls-0000ZU-Ch; Fri, 30 Jan 2015 12:34:00 +0000 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YHAlp-0000TC-9i for ath10k@lists.infradead.org; Fri, 30 Jan 2015 12:33:58 +0000 Received: by mail-we0-f171.google.com with SMTP id k11so24484576wes.2 for ; Fri, 30 Jan 2015 04:33:35 -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=8fy2k8QZyzUn6Z6J4Xjv+3B5X1tovMX9+do41AQZ5VA=; b=fn1SrDXdyOSVDhVVxAmO9s3QjV1AvFP4nEvWz1HYKqdCgK/wDkeUFXHeuivrt+dwuU ZSc7sr9RbI1ZKHf3aq1caeraS8JMtKjqne85xRUqEORIeETXfmewMbdoSsAggvRPCe9W wRonahIVUSKsKMugfQWr/GUJOq3srq8uO2+eY= 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=8fy2k8QZyzUn6Z6J4Xjv+3B5X1tovMX9+do41AQZ5VA=; b=ZCv9D1WzM6bref05MIJ3VGzszrx+c+jW86afkS5edtszxHLydBXatNI13NnJGxW3iE nwn5YJ5SqRTmkoIbug8rcf0UtRzPaSkjuCyF5iirOI61c8l4mqtKypAzvKCKS3uI//1E TE60D2NjQwNriB+rD8fdpgtDZTnDywCrhEwVtn7MKJzVVhscgUpbf+11T1gzIRUww9zQ phqZP2LD7dBM6O5/yqa1s3sqGNadHCYcmVKWGe6JQYgI7lEy4kybB4H4Tc8ypxz8ASgA tS5pBEGX9B6JhZVvamlKaRmxAZM+tyK55wXQQcdljES4GC/9Px1EBPrarshGn75/YDAE EP4A== X-Gm-Message-State: ALoCoQkbaifRMzrwOkNhUPtcbhK0DPUvH9q9dEwejqEiwfvdfbUyYbNjrC8xpZGKkkHmJmIkIrjQQkDXIS9e4n+ayDRlST2wnhe8xK5W8vqzFIcjKr6Ns0vo4GpPekNO48kvjxeP3+oINNPAlVfV7d8phyblVUpGQKXQzDwrbTeXsiLBFlpbgVY= X-Received: by 10.194.122.233 with SMTP id lv9mr11597276wjb.95.1422621215194; Fri, 30 Jan 2015 04:33:35 -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 fi10sm6730330wib.13.2015.01.30.04.33.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jan 2015 04:33:34 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH v2 4/7] ath10k: protect ar->arvifs linking with data_lock Date: Fri, 30 Jan 2015 13:31:23 +0100 Message-Id: <1422621086-28970-5-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1422621086-28970-1-git-send-email-michal.kazior@tieto.com> References: <1422607287-12289-1-git-send-email-michal.kazior@tieto.com> <1422621086-28970-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-20150130_043357_492152_0CFB6E1E X-CRM114-Status: UNSURE ( 7.91 ) 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 e099479..ba66a67 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3331,7 +3331,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. @@ -3458,7 +3461,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) { @@ -3493,7 +3498,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);