From patchwork Wed Dec 15 01:17:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vipin Mehta X-Patchwork-Id: 412141 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBF1Hr1T025727 for ; Wed, 15 Dec 2010 01:17:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932337Ab0LOBRw (ORCPT ); Tue, 14 Dec 2010 20:17:52 -0500 Received: from mail.atheros.com ([12.19.149.2]:36962 "EHLO mail.atheros.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932153Ab0LOBRv (ORCPT ); Tue, 14 Dec 2010 20:17:51 -0500 Received: from mail.atheros.com ([10.10.20.108]) by sidewinder.atheros.com for ; Tue, 14 Dec 2010 17:17:36 -0800 Received: from smtp.atheros.com (10.10.17.207) by SC1EXHC-02.global.atheros.com (10.10.20.111) with Microsoft SMTP Server (TLS) id 8.2.213.0; Tue, 14 Dec 2010 17:17:48 -0800 Received: by smtp.atheros.com (sSMTP sendmail emulation); Tue, 14 Dec 2010 17:18:01 -0800 From: Vipin Mehta To: CC: , , Subject: [PATCH] staging: ath6kl: Fixing device NULL pointer dereference Date: Tue, 14 Dec 2010 17:17:59 -0800 Message-ID: <1292375879-32085-1-git-send-email-vmehta@atheros.com> X-Mailer: git-send-email 1.6.3.3 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Dec 2010 01:17:53 +0000 (UTC) diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index a659f70..9f3e928 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -1608,6 +1608,15 @@ ar6000_avail_ev(void *context, void *hif_handle) struct wireless_dev *wdev; #endif /* ATH6K_CONFIG_CFG80211 */ A_STATUS init_status = A_OK; + HIF_DEVICE_OS_DEVICE_INFO osDevInfo; + + A_MEMZERO(&osDevInfo, sizeof(osDevInfo)); + if ( A_FAILED( HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE, + &osDevInfo, sizeof(osDevInfo))) ) + { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: Failed to get OS device instance\n", __func__)); + return A_ERROR; + } AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_available\n")); @@ -1627,7 +1636,8 @@ ar6000_avail_ev(void *context, void *hif_handle) device_index = i; #ifdef ATH6K_CONFIG_CFG80211 - wdev = ar6k_cfg80211_init(NULL); + wdev = ar6k_cfg80211_init(osDevInfo.pOSDevice); + if (IS_ERR(wdev)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: ar6k_cfg80211_init failed\n", __func__)); return A_ERROR; @@ -1672,12 +1682,7 @@ ar6000_avail_ev(void *context, void *hif_handle) #ifdef SET_NETDEV_DEV if (ar_netif) { - HIF_DEVICE_OS_DEVICE_INFO osDevInfo; - A_MEMZERO(&osDevInfo, sizeof(osDevInfo)); - if ( A_SUCCESS( HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_OS_DEVICE, - &osDevInfo, sizeof(osDevInfo))) ) { - SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); - } + SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); } #endif