Received: by 10.213.65.68 with SMTP id h4csp682563imn; Wed, 28 Mar 2018 10:48:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ZYPsGINMOQ8SPCROm93giQI8zZ3B/14dMtal0NObQhjV+ir+NYjdNDlvlvLxeiX/t9CLC X-Received: by 10.99.114.77 with SMTP id c13mr3231721pgn.8.1522259307327; Wed, 28 Mar 2018 10:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522259307; cv=none; d=google.com; s=arc-20160816; b=zs6odOdqmFCQopF1XPv07AJCMy1JMLTCWpGECaMPDIOK4U0GdXc3+2DJ73J21D4jJy kMlf2nOhb+OEuJlja+/kEzZAd4gJXPj1xYrsBW1WfSvlyaCg0xMt6s64EUQOpmDP5bA/ d727wltA2UYNEirULN8Om36c2yURlC8ONtNDDhNQa641oGeZL1Dl8feFHEGQnyCRfsV1 0O+sd5WoCfAj4NbtCjFqOQ6n0Ml1qA28eD58amr1CljH+HdID0sH7uhxnG0e3hQIpAlQ GcsWqenNJsg8sxlA38WjGNFfXp0Gwxs+zikRzp8+qdnq4RNubsPVJQo8r9igKKFVDItf zM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=uwq43inHY+g1ziIUvoANctGqOHhORtRrCRdfB7e7qMw=; b=lSU5E/mnr0KdSH+08NsDeWOvQZL43cvwvM8xStJwK15U+G2nkmeSBUjsJryls1tfsi KWebtgfi1sbvFpzS0RaodRYUBDtaYkvzbbJd5rlO6msSXSuuIBezOj3w6a3qwMyOuPNo llwSf+ZQBQXWvsG/Ap3uoKDQr4g5+xdm4c0aQx7qf8PUeMcKgHoliCWv5SZv3c3Is+Sv 5CKCT+oHuk4XvAsGbhxlBQxanbo3cDEYYbNsAKxv5u7rMHANiKg0Z8sUgzEIA3wc70R9 78wgzhD41VAAW8ywtVrFscIM10Gbqyd9mqx03O9+AYb7fsJjsSlxdvLm354S60IIJ8ui C1iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ofRw55oL; dkim=pass header.i=@codeaurora.org header.s=default header.b=l0hkmtOh; 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 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.48.07; Wed, 28 Mar 2018 10:48:27 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=ofRw55oL; dkim=pass header.i=@codeaurora.org header.s=default header.b=l0hkmtOh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753024AbeC1Rqr (ORCPT + 99 others); Wed, 28 Mar 2018 13:46:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:32940 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752580AbeC1Rqp (ORCPT ); Wed, 28 Mar 2018 13:46:45 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 052CC60AFB; Wed, 28 Mar 2018 17:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522259205; bh=89cLTVtsVIFqqhI0FDeE0D5Dd04jF17/6E5y3U2lDlk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ofRw55oL39WUDzNykJFlE8SKNGdx2YzvMgSKfQi1G0bS2/CogcrJnD0Y3oeKpeoug LvFhkJtRnevPe1jlYchdVAS/ZWqTaeAkiXnlxS41I6E7awO8dg5U4Aduob/eQycHC4 ishWjIk9fsJbZIGaDu56HVh3mVp0RlXXmBIoE3tU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 9BFF560591; Wed, 28 Mar 2018 17:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522259204; bh=89cLTVtsVIFqqhI0FDeE0D5Dd04jF17/6E5y3U2lDlk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=l0hkmtOh59qt3wqgeJwzjXOTw/4cC+GDNcVx+Xqkl1scXkmp51TLcNL/XOmJzw3uX nmrZ20/0LzZzroauj2mgdwtwWs1JdcsmmqP4fuQv2dpEQUngYVymPIZAKohZcNAEji 2iL2dKlyFQb5/0IhqO5IBCkiXecpvT7yiobEP/ik= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 28 Mar 2018 20:46:44 +0300 From: merez@codeaurora.org To: Colin King Cc: Kalle Valo , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless-owner@vger.kernel.org Subject: Re: [PATCH][next] wil6210: fix potential null dereference of ndev before null check In-Reply-To: <20180328174027.31551-1-colin.king@canonical.com> References: <20180328174027.31551-1-colin.king@canonical.com> Message-ID: <49ef31bc36217349a4801dc2eba4735c@codeaurora.org> X-Sender: merez@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-03-28 20:40, Colin King wrote: > 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 Reviewed-by: Maya Erez -- Maya Erez Qualcomm Israel, Inc. on behalf of Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project