From patchwork Tue Oct 7 15:04:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Puzyniak X-Patchwork-Id: 5046631 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 873EC9F2F1 for ; Tue, 7 Oct 2014 15:05:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 726CB20220 for ; Tue, 7 Oct 2014 15:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5AA3F201B9 for ; Tue, 7 Oct 2014 15:05:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753917AbaJGPFZ (ORCPT ); Tue, 7 Oct 2014 11:05:25 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:32855 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752281AbaJGPFW (ORCPT ); Tue, 7 Oct 2014 11:05:22 -0400 Received: by mail-wg0-f48.google.com with SMTP id k14so8202187wgh.31 for ; Tue, 07 Oct 2014 08:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=FWlR0L4yj+le6QRTWHQvitACEt4nMCaRoPAnQYsKh68=; b=qQdzxXddnPFoWdOM6ra2jLy9A5F5D4nvloktFTcCVORk01LL9HdAhKYh+0QAKtjiCn 63oCKFp3YQOxUxpM1ORat2K1dfZOQJcEQ1TamWKaw9TQaJDQUH9oaKaqLCCtyxrie3uH 6GKyLppXfDOzgk6h7rEaC3WLLpLXVv2deTiic= 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=FWlR0L4yj+le6QRTWHQvitACEt4nMCaRoPAnQYsKh68=; b=dLUjG8oS63KZFYAkENtYWeFu+Io4DI6nYX78kYf66/5yPVkXRmEYwtBiiaERQDlR3L koLR7FgWscHZJDkwYqbLQOwksxm5RGUP90eetty0fx8Xov/PUlSN66U8jvMhHwHtT1fJ ZT3S7XGnnrP6OM6IdXQfVBDZr1iSKHMx9uXxkb6sfUAYJdvxh4gjmvIQkb34IhnVqx/R daQM+WHyRTQDGOTGBohV1R2rf4R0wp+ub30tbhsPMoLOcYNwL8jLbjMYsZr/l4x7//m1 ubX6kDODKJrPiq73RUmTzm+vtwh1Ykco8Lbs/2ivixzvSLyK4oJXwzL0CuYg+NSHRMjf eU9w== X-Gm-Message-State: ALoCoQlBsvd24WY7a1HZnSDyd7/WGvQF/ClwkYhLiv2igcepRdzajxgRqZ1sJstbgVJFwJVoh04ci78tgUiaJEicpKJgJCdNsp9wKIFka8EIhGxOGWnU72NweAqqld2Jmm2SzTvFDbQu X-Received: by 10.180.24.35 with SMTP id r3mr5212526wif.71.1412694321164; Tue, 07 Oct 2014 08:05:21 -0700 (PDT) Received: from localhost.localdomain (apn-77-113-24-109.dynamic.gprs.plus.pl. [77.113.24.109]) by mx.google.com with ESMTPSA id bi7sm15052320wib.17.2014.10.07.08.05.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Oct 2014 08:05:20 -0700 (PDT) From: Marek Puzyniak To: ath9k-devel@lists.ath9k.org Cc: linux-wireless@vger.kernel.org, Marek Puzyniak Subject: [PATCH] ath9k_htc: avoid kernel panic in ath9k_hw_reset Date: Tue, 7 Oct 2014 17:04:30 +0200 Message-Id: <1412694270-14421-1-git-send-email-marek.puzyniak@tieto.com> X-Mailer: git-send-email 2.1.1 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 hw pointer of ath_hw is not assigned to proper value in function ath9k_hw_reset what finally causes kernel panic. This can be solved by proper initialization of ath_hw in ath9k_init_priv. Signed-off-by: Marek Puzyniak Acked-by: Oleksij Rempel --- [432866.234088] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030 [432866.234139] IP: [] ath9k_hw_reset+0xe05/0x13e0 [ath9k_hw] [432866.234183] PGD 220dc9067 PUD 220dca067 PMD 0 [432866.234213] Oops: 0000 [#1] SMP [432866.234234] Modules linked in: ath9k_htc ath9k_common ath9k_hw ath btrfs xor raid6_pq ufs qnx4 hfsplus hfs minix ntfs msdos jfs xfs libcrc32c reiserfs ext2 ppdev lp rfcomm bnep binfmt_misc nfsd auth_rpcgss nfs_acl nfs lockd fscache sunrpc snd_hda_codec_hdmi snd_hda_codec_idt snd_hda_codec_generic arc4 joydev uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common iwlmvm videodev iwldvm btusb mac80211 bluetooth snd_hda_intel i915 snd_hda_controller snd_hda_codec snd_hwdep snd_pcm snd_seq iTCO_wdt snd_seq_device iwlwifi parport_pc tpm_tis dell_laptop snd_timer cfg80211 drm_kms_helper snd drm psmouse parport soundcore video iTCO_vendor_support dcdbas i2c_algo_bit i2c_i801 lpc_ich dell_wmi pcspkr sparse_keymap serio_raw wmi evbug mac_hid ahci sdhci_pci libahci sdhci e1000e ptp pps_core [432866.234749] CPU: 0 PID: 3131 Comm: NetworkManager Tainted: G W 3.17.0-rc6-wl+ #63 [432866.234790] Hardware name: Dell Inc. Latitude E6420/0K0DNP, BIOS A08 10/18/2011 [432866.234826] task: ffff88021f1221c0 ti: ffff88021e920000 task.ti: ffff88021e920000 [432866.234862] RIP: 0010:[] [] ath9k_hw_reset+0xe05/0x13e0 [ath9k_hw] [432866.234913] RSP: 0018:ffff88021e923568 EFLAGS: 00010283 [432866.234940] RAX: 0000000000000000 RBX: ffff8801c2904330 RCX: 0000000000000006 [432866.234975] RDX: 0000000000000006 RSI: ffff88021f122a18 RDI: ffff88021f1221c0 [432866.235010] RBP: ffff88021e9235d8 R08: 0000000000000000 R09: 0000000000000000 [432866.235044] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [432866.235079] R13: 0000000000000000 R14: 0000000000000000 R15: ffff8801c2904000 [432866.235114] FS: 00007f8f64f64800(0000) GS:ffff88022dc00000(0000) knlGS:0000000000000000 [432866.235153] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [432866.235182] CR2: 0000000000000030 CR3: 0000000220c56000 CR4: 00000000000407f0 [432866.235216] Stack: [432866.235228] ffff88021e9235d8 ffffffff81800964 0000000000000000 00ff880120000000 [432866.235272] 00000000000183f5 ffff8801c2904040 ffff8801c2904040 ffff88021f7fb818 [432866.235315] ffff88021e9235d8 ffff8801c2a2a620 ffff8801c2904000 ffff8801c2a289a0 [432866.235359] Call Trace: [432866.235378] [] ath9k_htc_start+0xa3/0x280 [ath9k_htc] [432866.235414] [] ? mark_held_locks+0x6a/0x90 [432866.235458] [] ieee80211_do_open+0x331/0xdd0 [mac80211] [432866.235495] [] ? mutex_unlock+0xe/0x10 [432866.235532] [] ieee80211_open+0x61/0x70 [mac80211] [432866.235566] [] __dev_open+0xb6/0x130 [432866.235594] [] __dev_change_flags+0xac/0x180 [432866.235625] [] dev_change_flags+0x30/0x70 [432866.235657] [] ? get_page_from_freelist+0x822/0x980 [432866.235692] [] do_setlink+0x349/0x9e0 [432866.235721] [] ? trace_hardirqs_on_caller+0x10d/0x1d0 [432866.235755] [] ? trace_hardirqs_on+0xd/0x10 [432866.235786] [] rtnl_newlink+0x4cb/0x730 [432866.235816] [] ? rtnl_newlink+0x103/0x730 [432866.235848] [] rtnetlink_rcv_msg+0xa0/0x240 [432866.235879] [] ? trace_hardirqs_on+0xd/0x10 [432866.235910] [] ? rtnl_lock+0x17/0x20 [432866.235939] [] ? __rtnl_unlock+0x20/0x20 [432866.235970] [] netlink_rcv_skb+0xb1/0xc0 [432866.236000] [] rtnetlink_rcv+0x25/0x40 [432866.236029] [] netlink_unicast+0x18d/0x200 [432866.236060] [] netlink_sendmsg+0x31d/0x430 [432866.236091] [] sock_sendmsg+0x9c/0xd0 [432866.236121] [] ? might_fault+0x8c/0xa0 [432866.236149] [] ? might_fault+0x43/0xa0 [432866.236179] [] ? verify_iovec+0x56/0xe0 [432866.236208] [] ___sys_sendmsg+0x389/0x3a0 [432866.236239] [] ? __fget+0x5/0xe0 [432866.236266] [] ? __fdget+0x13/0x20 [432866.237561] [] ? __fget+0xaa/0xe0 [432866.238837] [] ? __fget+0x5/0xe0 [432866.240098] [] ? __fget_light+0x25/0x70 [432866.241357] [] __sys_sendmsg+0x49/0x90 [432866.242489] [] SyS_sendmsg+0x12/0x20 [432866.243308] [] system_call_fastpath+0x1a/0x1f [432866.244029] Code: 00 41 ff 57 10 bf de 46 03 00 e8 07 91 9c e0 e9 6d f4 ff ff 66 90 41 81 bf c8 02 00 00 c0 02 00 00 0f 84 df 03 00 00 49 8b 47 38 <80> 78 30 00 0f 84 7e fb ff ff f6 43 0a 30 49 8b 87 e0 16 00 00 [432866.245634] RIP [] ath9k_hw_reset+0xe05/0x13e0 [ath9k_hw] [432866.246399] RSP [432866.247145] CR2: 0000000000000030 [432866.252454] ---[ end trace 85181a8c528713c8 ]--- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index d779f4f..4014c4b 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -464,6 +464,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv, return -ENOMEM; ah->dev = priv->dev; + ah->hw = priv->hw; ah->hw_version.devid = devid; ah->hw_version.usbdev = drv_info; ah->ah_flags |= AH_USE_EEPROM;