From patchwork Thu Mar 17 09:52:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 8609041 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 381399F6E1 for ; Thu, 17 Mar 2016 09:50:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4FCFF2026C for ; Thu, 17 Mar 2016 09:50:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A30820304 for ; Thu, 17 Mar 2016 09:50:30 +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 1agUZV-00059C-De; Thu, 17 Mar 2016 09:50:25 +0000 Received: from mail-lf0-x230.google.com ([2a00:1450:4010:c07::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1agUZR-0003nJ-2x for ath10k@lists.infradead.org; Thu, 17 Mar 2016 09:50:23 +0000 Received: by mail-lf0-x230.google.com with SMTP id v130so11209424lfd.2 for ; Thu, 17 Mar 2016 02:50:00 -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=KrWU89oOwCFH4MUMWdQqtumx/IN8FyI0Ni6/i3AOSEg=; b=Bn/gQAea6rX9zCh2Lh3Yr78r+rCpuxDIpsILXoD1IzqV4XSDt+oh8CAgdPZs2XvJKk k8kDB7pGR36Enegm6yE7Dcm5wUyuN+1dKvM8B6+bEUE4ISPRmbyRNA4K9bhucA6iXlzP oeA9khvnFkms3PjZ4c5Yewm8vLfoIOp6Bwr7E= 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=KrWU89oOwCFH4MUMWdQqtumx/IN8FyI0Ni6/i3AOSEg=; b=Zubp2E38VlD9HP2b92lav/zabx1pZyAJGBrNHlPENwYp83We70pSBCLaXaWeflXIKU IoF0cVnQXqRVrNhPxAwWs5q+ogS17e+0t+hiVXa4jimc8y0GaTH/hcnNjOyuLoprX5QJ yeHO1V9Jrg/lrVXx5b68Rck2f6qu+dUsJNkqGPPzBKK2AAtQYO+ohiK0R9r7GtS73oEZ yGA+WpXEiQvvRG2Ve/N6WnhYLHCA6IJ9N+7O6dyMeEBhZMRyeIRP3HVMamPIvTaUHS15 zIutzSJ415MCCUAsNSLTESSkxhJpO9t5ePjQyy6NmX15e1/ZY2Ng3OznbLcBmpo53D/c GiPg== X-Gm-Message-State: AD7BkJKombLA6C7DdVglnL0Vl8Xej+DbAe5S6iTknFPj0L9rCItgaJ/iHslUDxjUDo5L5n4XwF9TnCZVuMSXsKO7wJCBs/MQSdLVDlUbsMsPpo4Itwa81w3e3FxM+PavmU258ZkXxcAEsbkIvp3WP4g1I2YXDjZWwjWSY/oRpCD5UCQd7nnVHwjIkouyl7Lctg== X-Received: by 10.25.138.7 with SMTP id m7mr3369736lfd.109.1458208199165; Thu, 17 Mar 2016 02:49:59 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id h192sm1279109lfb.45.2016.03.17.02.49.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Mar 2016 02:49:58 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: fix null deref if device crashes early Date: Thu, 17 Mar 2016 10:52:08 +0100 Message-Id: <1458208328-16827-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160317_025021_411934_911551D1 X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Michal Kazior 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,RP_MATCHES_RCVD,T_DKIM_INVALID,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 If device failed to init during early probing (which is quite rare) it triggered driver to compute crc before ar->firmware was ready causing an oops. Fixes: 3e58044b61a9 ("ath10k: print crc32 checksums for firmware and board files") Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 076d29b53ddf..5587f167bcdc 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -127,6 +127,7 @@ EXPORT_SYMBOL(ath10k_info); void ath10k_debug_print_hwfw_info(struct ath10k *ar) { char fw_features[128] = {}; + u32 crc = 0; ath10k_core_get_fw_features_str(ar, fw_features, sizeof(fw_features)); @@ -143,11 +144,14 @@ void ath10k_debug_print_hwfw_info(struct ath10k *ar) config_enabled(CONFIG_ATH10K_DFS_CERTIFIED), config_enabled(CONFIG_NL80211_TESTMODE)); + if (ar->firmware) + crc = crc32_le(0, ar->firmware->data, ar->firmware->size); + ath10k_info(ar, "firmware ver %s api %d features %s crc32 %08x\n", ar->hw->wiphy->fw_version, ar->fw_api, fw_features, - crc32_le(0, ar->firmware->data, ar->firmware->size)); + crc); } void ath10k_debug_print_board_info(struct ath10k *ar)