Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp593476imm; Fri, 1 Jun 2018 06:27:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJfLHdk4yIQoZYszy/WNE+lbepacid5I7b1VUY4ki1gZJaejypb1NghRz9NHEPRtgB4mHSJ X-Received: by 2002:a62:4d02:: with SMTP id a2-v6mr10870119pfb.2.1527859622187; Fri, 01 Jun 2018 06:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527859622; cv=none; d=google.com; s=arc-20160816; b=GP99KrGRrpNqbwShHYI7J0J4ZiNUSTyCH/3VQ0yV/F092r/UtyuNWbG/cz/g/wPIuz fedkkD0t/+v9+4QKWdCGhPicfvjTNttws+tOeQ5Is5gDX1l4O5Y1suyQG88yD5vwSxwo sa90Kpew8myuPvb3Hk+SCKO2KF5EaIbaTGuHdhEHT8gvkfaH0Gm6GrXekvDkcULI/Q3r o58G8GXGvmCarxwBYQH+geJBJDUkZzwbP/arko93Q+tJcT6c6OhZBqemNeJx7mPACuqI BDhvJ7G6+10QvwCnWJjIqmRHAbmCU9Cw/dyt3MkUdVUvaUI0Hwbv/CC0S3YbOQF04fgN Qsww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=6q1eT0ObwV2z4SeWquBAnC9Bp55unR0ECsmG0ro1QAw=; b=lBCtGog+UuMeFBG+lfGvahTI3b6UHXRyQCE/CMzWJnAKCde2r+/D4HrO8TyBwPFu2w 55L8hxxgC7gXV7CiYC5Q0q+XX56DUXxLeEF0k88Mcq/T4SkzzhkAASgq5727Fj8zjVoW 34Q1OZbZiW5WtY0GkVcheLnu7GFcR9mU47SCUyTyPa6WdKVbFOVZbrUNAmRtMCPk1B5c dLrl6Ww+KxejLbD0pIyQBb0ITaVDL6ijczi294vy7D9BkvpWQYs6VIkxzXgeqHNkDTni nbKD4VhB7TDudedJ0wE7Mot5mhJgLKi6lvlNEUGTz3WRlHhZ6MudVIhqMqdDTPbLCzf0 D55w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w66-v6si41117918pfj.144.2018.06.01.06.26.45; Fri, 01 Jun 2018 06:27:02 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752638AbeFANYq (ORCPT + 99 others); Fri, 1 Jun 2018 09:24:46 -0400 Received: from gateway21.websitewelcome.com ([192.185.46.113]:13923 "EHLO gateway21.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751918AbeFANYK (ORCPT ); Fri, 1 Jun 2018 09:24:10 -0400 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 8C3EA400C9C51 for ; Fri, 1 Jun 2018 08:24:09 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id Ok2Lf46gfkBj6Ok2LfYYEM; Fri, 01 Jun 2018 08:24:09 -0500 X-Authority-Reason: nr=8 Received: from [187.192.46.223] (port=59888 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1fOk2K-000ga3-UG; Fri, 01 Jun 2018 08:24:09 -0500 Date: Fri, 1 Jun 2018 08:24:08 -0500 From: "Gustavo A. R. Silva" To: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich , Kalle Valo , "David S. Miller" Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , kernel-janitors@vger.kernel.org Subject: [PATCH] qtnfmac: fix NULL pointer dereference Message-ID: <20180601132408.GA2572@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 187.192.46.223 X-Source-L: No X-Exim-ID: 1fOk2K-000ga3-UG X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [187.192.46.223]:59888 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 8 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case *vif* is NULL at 655: if (!vif), the execution path jumps to label out, where *vif* is dereferenced at 679: if (vif->sta_state == QTNF_STA_CONNECTING) Fix this by immediately returning when *vif* is NULL instead of jumping to label out. Addresses-Coverity-ID: 1469567 ("Dereference after null check") Fixes: 480daa9cb62c ("qtnfmac: fix invalid STA state on EAPOL failure") Signed-off-by: Gustavo A. R. Silva --- drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c index 220e2b7..ae0ca80 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c +++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c @@ -654,8 +654,7 @@ qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, vif = qtnf_mac_get_base_vif(mac); if (!vif) { pr_err("MAC%u: primary VIF is not configured\n", mac->macid); - ret = -EFAULT; - goto out; + return -EFAULT; } if (vif->wdev.iftype != NL80211_IFTYPE_STATION) { -- 2.7.4