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: 5749511 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 6BD17BF440 for ; Fri, 30 Jan 2015 12:33:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CEA2202BE for ; Fri, 30 Jan 2015 12:33:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07C46202E6 for ; Fri, 30 Jan 2015 12:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761332AbbA3Mdk (ORCPT ); Fri, 30 Jan 2015 07:33:40 -0500 Received: from mail-we0-f182.google.com ([74.125.82.182]:55073 "EHLO mail-we0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756791AbbA3Mdg (ORCPT ); Fri, 30 Jan 2015 07:33:36 -0500 Received: by mail-we0-f182.google.com with SMTP id l61so26824475wev.13 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=YcRgVTn/vM/l2ykANC7t7qsceTiR5FUn1hsMt6JK/xN6ifvGHybo+SVUHNFOGGZi2C yxhWlFOsVWx8C/cJyVUmkW+AZrjFJzaVAmlI3Rpd8y4BRQFgTqcleBwC3S4r01taKchE 1q7/XqmQ4Bp+OrUra9OBu3ZVzZ0uzUJft3nrFRxL+KQveiBPm1rxUmT+0VoJMLtCZpbn TNFZc/LaI6LFPaTsUx47rSIsR43UmqxV8PSEiqFQ7OIHGOMnjwJ/RsgMPxiRz19FDdTv 7TfsHJ5T9YqQOF4hK03kUsLU3xoyK+TmOxWfhqVzSBelk6MhTEs+nCngyv0W6l+MhXcG cLwQ== X-Gm-Message-State: ALoCoQnJXB1a89/GWQxXrX5KPkQYuCv2dLh/m2NhHkIJtsB8EY1g6SlKA6TfpUYmSwPWtm8evjw8CXfsK7ek/BmYObe5mKZV/QTVxtm9qgCVb8cNA1WdXaFzmlOlsR8QJT5ZJtGH8P2D 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 Cc: linux-wireless@vger.kernel.org, Michal Kazior 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 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 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);