From patchwork Wed Jun 8 17:07:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 9165315 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0523F60467 for ; Wed, 8 Jun 2016 17:07:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4F422810E for ; Wed, 8 Jun 2016 17:07:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9DAE282DC; Wed, 8 Jun 2016 17:07:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98F242810E for ; Wed, 8 Jun 2016 17:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758186AbcFHRH4 (ORCPT ); Wed, 8 Jun 2016 13:07:56 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:48958 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758183AbcFHRHy (ORCPT ); Wed, 8 Jun 2016 13:07:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qualcomm.com; i=@qualcomm.com; q=dns/txt; s=qcdkim; t=1465405674; x=1496941674; h=from:cc:to:subject:date:message-id:x-mailer:in-reply-to: references; bh=0w3WbL9YP951yHREi0dCNUKvPIa+T1C0ZRzP9vJj91A=; b=M95eaq9ZRyuc+y+xvH+E1UwMfFbze+JqMkvlwzMraNaAFcW0MOMtRn6v nXQV07656BUuOFqZvftk7it7j3Y8IGhqTkR09lOs/Z3S84UOo0NP7yFHF r704hmCbuklkSnJBT8bmxGvZ/5P7pfT+/MHpfdKLaXeOVvRIBaaiu6x9Z g=; X-IronPort-AV: E=Sophos;i="5.26,440,1459839600"; d="scan'208";a="199197141" Received: from ironmsg03-l-new.qualcomm.com (HELO Ironmsg03-L.qualcomm.com) ([10.53.140.110]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Jun 2016 10:07:54 -0700 From: Maya Erez Cc: Maya Erez , linux-wireless@vger.kernel.org, wil6210@qualcomm.com X-IronPort-AV: E=McAfee;i="5700,7163,8190"; a="1162664179" Received: from lx-merez.mea.qualcomm.com ([10.18.173.103]) by Ironmsg03-L.qualcomm.com with ESMTP; 08 Jun 2016 10:07:52 -0700 To: Kalle Valo Subject: [PATCH 1/2] wil6210: fix chan check in wil_p2p_listen Date: Wed, 8 Jun 2016 20:07:47 +0300 Message-Id: <1465405668-15881-2-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1465405668-15881-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1465405668-15881-1-git-send-email-qca_merez@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In wil_p2p_listen chan is checked to protect against NULL pointer access only before setting channel = chan->hw_value. Add a global parameter check to cover all accesses to chan. Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/p2p.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/p2p.c b/drivers/net/wireless/ath/wil6210/p2p.c index 1c91538..213b825 100644 --- a/drivers/net/wireless/ath/wil6210/p2p.c +++ b/drivers/net/wireless/ath/wil6210/p2p.c @@ -114,8 +114,10 @@ int wil_p2p_listen(struct wil6210_priv *wil, unsigned int duration, u8 channel = P2P_DMG_SOCIAL_CHANNEL; int rc; - if (chan) - channel = chan->hw_value; + if (!chan) + return -EINVAL; + + channel = chan->hw_value; wil_dbg_misc(wil, "%s: duration %d\n", __func__, duration);