From patchwork Tue Jun 23 19:55:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223212 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA2CFC433DF for ; Tue, 23 Jun 2020 21:18:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B908020702 for ; Tue, 23 Jun 2020 21:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592947106; bh=fj/x7rSPHOZ2ByQ3wbcDNH0tQxIK5yNXYJHMNshSJBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=fiChTCxAsBBipVSPh0FEnUgBP3K8xN2fZH5DTeO45X2BHe73iv3Ib5Oqn+O9ZBBDA MZ2IYX0GC80bZPxuYEpQ6izRrVSV+xH8fffN+ixVFgROD16qBicKqzqaLJQqlSeaBQ LhORpXwQnkSmbLQJAH7yC6/WQXYLha6pNzkWZC3A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390346AbgFWUZ6 (ORCPT ); Tue, 23 Jun 2020 16:25:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:44980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390596AbgFWUZ4 (ORCPT ); Tue, 23 Jun 2020 16:25:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B6C4206EB; Tue, 23 Jun 2020 20:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943955; bh=fj/x7rSPHOZ2ByQ3wbcDNH0tQxIK5yNXYJHMNshSJBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWPKe2PhUM8NNCuNknxeXirS2SWobudfo88wJ9iCVtnwksMW5JSknUJmudHNKcpJ8 V5LF79uKIFf+0Zp/V6lIoo3BFrLvknRD95JOpcmvAOSGIEivCRL2t/GzvwG3qlM/TH nGsdTLgKpy7ys2oocBB5z2hkpDDeFtgLcMQK4UQE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ajay Singh , Oscar Carter , Sasha Levin Subject: [PATCH 5.4 116/314] staging: wilc1000: Increase the size of wid_list array Date: Tue, 23 Jun 2020 21:55:11 +0200 Message-Id: <20200623195344.402673154@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Oscar Carter [ Upstream commit a4338ed2e1cf724563956ec5f91deeaabfedbe23 ] Increase by one the size of wid_list array as index variable can reach a value of 5. If this happens, an out-of-bounds access is performed. Also, use a #define instead of a hard-coded literal for the new array size. Addresses-Coverity-ID: 1451981 ("Out-of-bounds access") Fixes: f5a3cb90b802d ("staging: wilc1000: add passive scan support") Acked-by: Ajay Singh Signed-off-by: Oscar Carter Link: https://lore.kernel.org/r/20200504150911.4470-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/wilc1000/wilc_hif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_hif.c b/drivers/staging/wilc1000/wilc_hif.c index 77d0732f451be..221e3d93db148 100644 --- a/drivers/staging/wilc1000/wilc_hif.c +++ b/drivers/staging/wilc1000/wilc_hif.c @@ -12,6 +12,8 @@ #define WILC_FALSE_FRMWR_CHANNEL 100 #define WILC_MAX_RATES_SUPPORTED 12 +#define WILC_SCAN_WID_LIST_SIZE 6 + struct wilc_rcvd_mac_info { u8 status; }; @@ -233,7 +235,7 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, void *user_arg, struct cfg80211_scan_request *request) { int result = 0; - struct wid wid_list[5]; + struct wid wid_list[WILC_SCAN_WID_LIST_SIZE]; u32 index = 0; u32 i, scan_timeout; u8 *buffer;