Received: by 10.213.65.68 with SMTP id h4csp677847imn; Wed, 28 Mar 2018 10:42:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx493Cd2skJT8lOCWBfpAggJJE6EXR+Ft1GZQmwjyeMl94aWEtRI+iFkzU17Z9yH0jZeq5NMa X-Received: by 10.99.105.138 with SMTP id e132mr3140334pgc.407.1522258929758; Wed, 28 Mar 2018 10:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522258929; cv=none; d=google.com; s=arc-20160816; b=sr+hJukf+lGxrzdoe1YH8YVwOtsDQxFsCLeTNHNT+A1HbxJZomGQoIhmhw42+hqbyY ITCMCfZHYHvHtui3j7nfBzmcKQtvH1bKpdQHdci4fKZRKeOe4APxMADLwgRv5mgek+F3 UvTXRKOlzLgfyiW2fWd22py5tKbzgH4hqxdjgCQF9Skse+Vyv4VzM2zM4uSxB4VoSeAE OKZ9ffVQrSsNOoSnBNfLfexexyln2LF/2WwK4w7BmzLFhxvvwjCf1y3HUsIWJ2tk9smw z5yexpY/bJVvi2xCTmwP6uNqEDL3gFuuRY97Pm6/P4xh6n4P1XPPf0V5BpPP3DNCXz2o dipg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=lbYMkcAu53L2xYIBJDt+Wz571FHmk4b64MQA8R3KDCg=; b=aC0Vi4Z+JgE54tXoM/Msdnv968H6RvO9iRZvshpX+NwLp/Jofi+JZ3fEmW1Fg7dx2w l09XgoDiJwKgqD7F5hWsuBypv2WhyOzBPnVisuKqDkyEcFLeiHvYs19rFBDDvFD++eek RaOv4W9k4POAn1tODAlQlwE0uhKwpqA2HngIKirqaUUmjmxs2AhVkuRxJTLeJtwZ+ABA Ma51WXOhbcocpPORg9leKdKXPCnTIugnSwcP+ZOs1xdoz1AsbM6vDH43m4JdhZJNwWno kpW9d/R14br185ZOG1ckOli3iUOFSQSZM8BUyhJDbdGkIFOtRKI9U+jSWi898twMxnjn L7bA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh5-v6si3918791plb.480.2018.03.28.10.41.54; Wed, 28 Mar 2018 10:42:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752832AbeC1Rkb (ORCPT + 99 others); Wed, 28 Mar 2018 13:40:31 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:49754 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752349AbeC1Rk3 (ORCPT ); Wed, 28 Mar 2018 13:40:29 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1f1F3j-0007TB-WB; Wed, 28 Mar 2018 17:40:28 +0000 From: Colin King To: Maya Erez , Kalle Valo , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] wil6210: fix potential null dereference of ndev before null check Date: Wed, 28 Mar 2018 18:40:27 +0100 Message-Id: <20180328174027.31551-1-colin.king@canonical.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The pointer ndev is being dereferenced before it is being null checked, hence there is a potential null pointer deference. Fix this by only dereferencing ndev after it has been null checked Detected by CoverityScan, CID#1467010 ("Dereference before null check") Fixes: e00243fab84b ("wil6210: infrastructure for multiple virtual interfaces") Signed-off-by: Colin Ian King --- drivers/net/wireless/ath/wil6210/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index a4b413e8d55a..82aec6b06d09 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -391,7 +391,7 @@ static void wil_fw_error_worker(struct work_struct *work) struct wil6210_priv *wil = container_of(work, struct wil6210_priv, fw_error_worker); struct net_device *ndev = wil->main_ndev; - struct wireless_dev *wdev = ndev->ieee80211_ptr; + struct wireless_dev *wdev; wil_dbg_misc(wil, "fw error worker\n"); @@ -399,6 +399,7 @@ static void wil_fw_error_worker(struct work_struct *work) wil_info(wil, "No recovery - interface is down\n"); return; } + wdev = ndev->ieee80211_ptr; /* increment @recovery_count if less then WIL6210_FW_RECOVERY_TO * passed since last recovery attempt -- 2.15.1