Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1946315lqo; Mon, 13 May 2024 03:27:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZ81cOD0cRut0REnGrJvk2JHA3eqKQuFeGlJEpx4rPzHWiO8KwkFhx3e5g0YRmv9iTia/p4u5H6EKc4DoKc/M5Flfa4Ow41Zm9qVCfTw== X-Google-Smtp-Source: AGHT+IEzfnQC88BUMaNGrknY/SULjmmjN2SB1t01vlv1WxDdi5NseZkfM+hMqcJ27ofxtI1Zv21N X-Received: by 2002:a17:906:64c:b0:a59:efb8:28ca with SMTP id a640c23a62f3a-a5a118bfcebmr977232866b.32.1715596066451; Mon, 13 May 2024 03:27:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715596066; cv=pass; d=google.com; s=arc-20160816; b=ZIvDbLaqXdpwea8lXjPetNksj3eK0MFHWkVzMRXQ9LJ7xiniRSPpmiRoPGus5MJyMs 0wVDUV4Ri8nC6bh3d/EPAJK0/vMXaKYTHpeQ06DbnYw8wS9xMO4/ocSrSVwmyxsIQ1wA qUmwbpa1O3Is1Ltc0TlEZ7i07WDF1nRNFC4+MeNStL2U0yW3nRCprPYihrLfgzKBslD4 FTLHtzyn0WXqiEzkdfcMtGo73Nf23oOdYyrcAUtRgBTSSIa/MQ3x/i8XGNAc9AwTCpFj K1Lb317h9dEPKfY/+3Uv09RgFECPOp3Dpi9LDvh4XoBb1HR3X0evchqbSLpDDgfTxyk2 7J/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=DimD9ovPNuxYCzsJxkAn2Jf6cebaI0GLFrM9LpMV5Rw=; fh=o/jSBnEq+q6f0RIvwQCm9vXYTY2ht4wko+kYqXvm+0E=; b=rFVauHeCOoF7YmIc83INDILLZII42Rc9etZFjIl3hJK6rXTaFz4jCjW3cvxOeDu/ch cGvMDqqbxViddaylAeGyzEGpy1BN1MZ+lRFcHAYRFtO6Jay44sAX12FC+g5D83buxDzC 0YXKmTn+t4kUh6acScra2kWVfOztKYGCDfpI7KkX+p6C5KbwCMMaQ08QCDfUt9ZTVroc Z3KnJHK3bZnTYNBBGz2K3Xj+Zri3d1ZYWz71MK8YTu8Ne+9mL/jZYZhtrjX0qde9MU8B Gy5eqvgS9Oq1EEHWKVuwZFCqyRkjnPeJpSZe8FMRmsIQChqz8rE1ddH1EzJUsENhli1q U/2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cJhhCN8b; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-7586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7586-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733beac411si5258226a12.1.2024.05.13.03.27.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 03:27:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cJhhCN8b; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-7586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7586-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 350611F242A7 for ; Mon, 13 May 2024 10:27:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED93B14A61B; Mon, 13 May 2024 10:27:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cJhhCN8b" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A41614A0A6 for ; Mon, 13 May 2024 10:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596049; cv=none; b=aE16wsQr8PdTeGKDgXrknH1oCNXCAY9ezbCi1djd6mlDbIhREO32NBp90qOza68QF/DIhQk+sTkj77vQD7TD/0MKQY7ZCMH1Eawg9Qu8sUbBcARIdXNspj4qEKA4Ajt4FfbUl9XHQgfe0CHI9bS4fXl2iNANFaOyfAJXSCcwcPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715596049; c=relaxed/simple; bh=RKKWcwljq5xkvx8k3QVlHrC1gZJe/YGB0AlWBmV5/Pw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g111XZ8QVaOxE5/5VqIiTBtzd1dfJ8koA1834hkzP3bc43R3ZrnT0CfmzGXQF4/HO4ovqPE924yRFF24G+KyzCkHASPRfTaupG4cknYJoN4r189R8Dlc2TP6a+K/eHBPMLYvFMZNCLrNIYuVqD4v5AaQ7PlwITTG8bJYkgF3udA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cJhhCN8b; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715596049; x=1747132049; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RKKWcwljq5xkvx8k3QVlHrC1gZJe/YGB0AlWBmV5/Pw=; b=cJhhCN8br9sRgwT3tbpunNnr7JqU/uUupFMMgCKeit2kTdFsHYJFhj2c tl8eiWzW+oqZuSotm4lZtxPZAv82kNp1CDkF9tuoV2kfbqMz8ToQMglZJ FGLGUFGz05WvL1fBjfbIZ1hXfPfkdLDqHSHttTJdcTW930Fh0lSXtsCt3 oH47WrbCtBtna05mIJ7u+EsRWJnXc+ohFb5c8qeOmFC5JAhvhZeCn+IMt uIBJ66TkiIMHlR2RNH7bKeaM596Zeoc3qrwjvCIP/wzL4XuFzzdeBB+5F q13Ym+KxS/xqPKKJ6QxlPls/2jxePa3ra4bfwZue3ATAORh1fzaSy2ujr w==; X-CSE-ConnectionGUID: dtEqSW34QPmlhwP1v95hQg== X-CSE-MsgGUID: RF/88QhkSniIxzvpONx03A== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="22928665" X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="22928665" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:28 -0700 X-CSE-ConnectionGUID: XTV8vse9S7evLT3LIFBx0A== X-CSE-MsgGUID: Z5U6lY62TN2LpMQiihkmhg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,158,1712646000"; d="scan'208";a="53516416" Received: from weis0040.iil.intel.com ([10.12.217.108]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2024 03:27:26 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer , Johannes Berg Subject: [PATCH 5/7] wifi: iwlwifi: mvm: check n_ssids before accessing the ssids Date: Mon, 13 May 2024 13:27:12 +0300 Message-Id: <20240513132416.6e4d1762bf0d.I5a0e6cc8f02050a766db704d15594c61fe583d45@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> References: <20240513102714.469087-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited Content-Transfer-Encoding: 8bit In some versions of cfg80211, the ssids poinet might be a valid one even though n_ssids is 0. Accessing the pointer in this case will cuase an out-of-bound access. Fix this by checking n_ssids first. Fixes: c1a7515393e4 ("iwlwifi: mvm: add adaptive dwell support") Signed-off-by: Miri Korenblit Reviewed-by: Ilan Peer Reviewed-by: Johannes Berg --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 85d8cbe6d248..bed2cd81f8b5 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -1303,7 +1303,7 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm, if (IWL_MVM_ADWELL_MAX_BUDGET) cmd->v7.adwell_max_budget = cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); - else if (params->ssids && params->ssids[0].ssid_len) + else if (params->n_ssids && params->ssids[0].ssid_len) cmd->v7.adwell_max_budget = cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); else @@ -1405,7 +1405,7 @@ iwl_mvm_scan_umac_dwell_v11(struct iwl_mvm *mvm, if (IWL_MVM_ADWELL_MAX_BUDGET) general_params->adwell_max_budget = cpu_to_le16(IWL_MVM_ADWELL_MAX_BUDGET); - else if (params->ssids && params->ssids[0].ssid_len) + else if (params->n_ssids && params->ssids[0].ssid_len) general_params->adwell_max_budget = cpu_to_le16(IWL_SCAN_ADWELL_MAX_BUDGET_DIRECTED_SCAN); else -- 2.34.1