From patchwork Mon Aug 15 15:00:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adi Ratiu X-Patchwork-Id: 9281191 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 07D4F60467 for ; Mon, 15 Aug 2016 15:00:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE4B528CE4 for ; Mon, 15 Aug 2016 15:00:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E316D28D0E; Mon, 15 Aug 2016 15:00:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68F3628CE4 for ; Mon, 15 Aug 2016 15:00:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753157AbcHOPAY (ORCPT ); Mon, 15 Aug 2016 11:00:24 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35500 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752821AbcHOPAW (ORCPT ); Mon, 15 Aug 2016 11:00:22 -0400 Received: by mail-wm0-f66.google.com with SMTP id i5so11557337wmg.2 for ; Mon, 15 Aug 2016 08:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=dCOpqjk54qzKPy4dDJcjVJbYCjKLxLUOiaRl2IcuSDU=; b=KQBG3AqlPvjAR104VxN/kkn7EOqaov0VnjEUriXlJ74DBJaps6VyPNwhztWB5mOzDA I4te7fK+MzFpwNCOPTR3uiQcEra44ll3a0hWozr432O3PicD7WpfPLEv5NVdZC/G7dao iLLx/7je89FPPLoO2/IamsTuaY6qDnybNzQYACIT0hul3euX/8P3r+7YQ4KrQ4JKk+Sm 4M2PIPxP/KL2VvMiVgCK2YX28SdkG8C5jCFWrXpj9OB7M7LjWKAzA39eFnqTkgUdbQbT NzrX81EqsCuKDb3QK4PxJFyIOSMmUUV4A2oBZmUeYZJFE21zdpI1PIr6dxgIEj5kKhs2 RlZA== 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; bh=dCOpqjk54qzKPy4dDJcjVJbYCjKLxLUOiaRl2IcuSDU=; b=ICUVc1UHqT+F1lZEkk4tcqZjSGQFvpzgjbF5BJnFjdU/Jwel7FC2Pgeum5LcWMaWQY k+qOSqs80lMdeuJiYsjdbI+BXWoBeB4h4vOiqs4LnIF7C/o2VzrIh6uJiTTJ5AQh0nvM HaLNpUUwnXW7kM0zkWAPTEBUN+d6Z/f0hKPpMX0T54KA7GPVJr+P1wNwO1qDxgxuNuMx 9NjdGI9XBQh3gozwlyI/+q02G0nBZrKuUDX5E4K8KKvxJoqDLQS1DpxWMyieqBXcdQIg ubDlNMXjnaPMCJRZdDS5OzZqrAtjxQYGqCltluBfamsS2vD1484eoAm1AzjxqKxFUaVq Ugtg== X-Gm-Message-State: AEkoouu2kkW2sLQIiYh2YTvuoT4OgMNSSQI2TgwmpDWkfkfQIqwURxb9Arg1kNO9DCEUSw== X-Received: by 10.194.133.200 with SMTP id pe8mr30807434wjb.14.1471273220620; Mon, 15 Aug 2016 08:00:20 -0700 (PDT) Received: from adiPC.lan ([188.24.81.109]) by smtp.gmail.com with ESMTPSA id yz6sm21936464wjb.35.2016.08.15.08.00.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Aug 2016 08:00:20 -0700 (PDT) From: Ioan-Adrian Ratiu To: linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org, ath9k-devel@qca.qualcomm.com, ath9k-devel@lists.ath9k.org, linux-kernel@vger.kernel.org Subject: [PATCH] ath9k: Fix beacon configuration assertion failure Date: Mon, 15 Aug 2016 18:00:28 +0300 Message-Id: <20160815150028.7909-1-adi@adirat.com> X-Mailer: git-send-email 2.9.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP commit cfda2d8e2314 ("ath9k: Fix beacon configuration for addition/removal of interfaces") reworked beacon configs to happen at IF changes and missed cases when NL80211_IFTYPE_STATION has no beacons with the corresponding values iter_data.primary_beacon_vif == 0 and iter_data.nbcnvifs == 0 in ath9k_calculate_summary_state(), thus calling ath9k_beacon_config() with null and giving the below warning. Fix this by calling beacon config only when a beacon actually exists, i.e. by checking iter_data.beacons which should be set only inside ath9k_vif_iter_set_beacon() (the line "iter_data.beacons = true;" in ath9k_calculate_summary_state() is a bug in above rework commit). [ 16.910537] ------------[ cut here ]------------ [ 16.910549] WARNING: CPU: 2 PID: 6 at drivers/net/wireless/ath/ath9k/beacon.c:642 ath9k_beacon_config+0x12c/0x130 [ath9k] [ 16.910551] Modules linked in: intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel hid_generic aesni_intel usbhid hid aes_x86_64 joydev mousedev arc4 lrw ath9k dell_laptop ath9k_common ath9k_hw ath mac80211 gf128mul glue_helper ablk_helper dell_smbios input_leds cryptd led_class snd_hda_codec_hdmi psmouse cfg80211 serio_raw atkbd snd_hda_codec_realtek libps2 rfkill r8169 sr_mod snd_hda_codec_generic dcdbas cdrom mii snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core i8042 snd_pcm snd_timer serio ac xhci_pci xhci_hcd battery i2c_i801 tpm_tis pcspkr tpm_tis_core evdev shpchp lpc_ich i2c_smbus tpm sch_fq_codel ip_tables x_tables [ 16.910620] CPU: 2 PID: 6 Comm: kworker/u16:0 Not tainted 4.8.0-rc1-next-20160815-g118253a #1 [ 16.910621] Hardware name: Dell Inc. Inspiron 3521/018DYG, BIOS A14 07/31/2015 [ 16.910648] Workqueue: phy0 ieee80211_iface_work [mac80211] [ 16.910652] 0000000000000000 ffff880159f13630 ffffffff813140f0 0000000000000000 [ 16.910657] 0000000000000000 ffff880159f13670 ffffffff8106b22b 0000028200000202 [ 16.910661] ffff880156bc1500 0000000000000000 ffff880153cc8018 ffff880153cc8018 [ 16.910666] Call Trace: [ 16.910674] [] dump_stack+0x63/0x83 [ 16.910678] [] __warn+0xcb/0xf0 [ 16.910682] [] warn_slowpath_null+0x1d/0x20 [ 16.910690] [] ath9k_beacon_config+0x12c/0x130 [ath9k] [ 16.910696] [] ath9k_calculate_summary_state+0xf6/0x350 [ath9k] [ 16.910703] [] ath9k_bss_info_changed+0x186/0x1a0 [ath9k] [ 16.910720] [] ieee80211_bss_info_change_notify+0xb1/0x200 [mac80211] [ 16.910737] [] ieee80211_assoc_success+0x677/0xdeb [mac80211] [ 16.910746] [] ? up+0x32/0x50 [ 16.910751] [] ? wake_up_klogd+0x3b/0x50 [ 16.910755] [] ? console_unlock+0x539/0x5f0 [ 16.910760] [] ? vprintk_emit+0x254/0x490 [ 16.910765] [] ? vprintk_default+0x1f/0x30 [ 16.910769] [] ? printk+0x48/0x50 [ 16.910788] [] ieee80211_rx_mgmt_assoc_resp+0x152/0x4c0 [mac80211] [ 16.910807] [] ieee80211_sta_rx_queued_mgmt+0x18f/0x840 [mac80211] [ 16.910813] [] ? lock_timer_base.isra.2+0x80/0xa0 [ 16.910817] [] ? cpuacct_charge+0x86/0xa0 [ 16.910822] [] ? update_curr+0xb7/0x160 [ 16.910827] [] ? dequeue_entity+0x24c/0xa20 [ 16.910831] [] ? dequeue_task_fair+0x5c3/0x960 [ 16.910848] [] ? ieee80211_iface_work+0xd4/0x410 [mac80211] [ 16.910865] [] ieee80211_iface_work+0x295/0x410 [mac80211] [ 16.910870] [] ? finish_task_switch+0x77/0x1e0 [ 16.910875] [] process_one_work+0x1e5/0x470 [ 16.910880] [] worker_thread+0x48/0x4e0 [ 16.910885] [] ? process_one_work+0x470/0x470 [ 16.910888] [] kthread+0xc9/0xe0 [ 16.910894] [] ? __switch_to+0x2c3/0x610 [ 16.910899] [] ret_from_fork+0x1f/0x40 [ 16.910902] [] ? kthread_create_on_node+0x40/0x40 [ 16.910904] ---[ end trace aa169ad4461f2f18 ]--- Signed-off-by: Ioan-Adrian Ratiu --- drivers/net/wireless/ath/ath9k/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index a394622..3c6f413 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -1154,7 +1154,6 @@ void ath9k_calculate_summary_state(struct ath_softc *sc, bool changed = (iter_data.primary_sta != ctx->primary_sta); if (iter_data.primary_sta) { - iter_data.beacons = true; ath9k_set_assoc_state(sc, iter_data.primary_sta, changed); ctx->primary_sta = iter_data.primary_sta; @@ -1166,10 +1165,12 @@ void ath9k_calculate_summary_state(struct ath_softc *sc, if (ath9k_hw_mci_is_enabled(sc->sc_ah)) ath9k_mci_update_wlan_channels(sc, true); } + } else if (iter_data.beacons) { + sc->nbcnvifs = iter_data.nbcnvifs; + ath9k_beacon_config(sc, iter_data.primary_beacon_vif, + iter_data.beacons); } - sc->nbcnvifs = iter_data.nbcnvifs; - ath9k_beacon_config(sc, iter_data.primary_beacon_vif, - iter_data.beacons); + ath9k_hw_set_interrupts(ah); if (ah->slottime != iter_data.slottime) {