Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1497685lqo; Sun, 12 May 2024 05:25:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXS5dgtIHdsfJjlB0ViMmBXW7FAZYq+vwaJS6foakDBrHi8zAc5QMJ3Cq6rO9G7V5mc+HQYOj8A8ylqtJ1dh+ltiAQj3mI5gabtfMbkg== X-Google-Smtp-Source: AGHT+IEjg+k0oFBAxtqhqJvIRKyP3/8owgrTz9kPXu5mSWgH08fpK+rle4P1PcXTBj3VNvRCZ67h X-Received: by 2002:a05:6a21:2b0a:b0:1af:9ee6:25c4 with SMTP id adf61e73a8af0-1afde201d56mr5790395637.42.1715516756454; Sun, 12 May 2024 05:25:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715516756; cv=pass; d=google.com; s=arc-20160816; b=B8bfEJlHJZ2aX3XQdoG/b79JmvxZEA8NynFZkQc66XtW6mK2KDy31xtMDNYZU5IwR3 WVWq2R+WmdA5gtLuf3z2NU8pnLNkOc4lw2B2EsVAaMzONZHja4IWRhrhT+d2CGZoM3ni 8pdC2M9aAg+POju/+AYpnXVXAm+CZDYLX8AcpNg2qK6DOmZcngVqv48lqOe3rN8/qRe7 CKHCnrrzYwv31/BIW3BkAKvQBixxrYGNCyIxLOJ3vS/7us1xY7vAItj8H0U0yz9nXErP pYhKjoT+TXrDaDRO0zdazzlYKSw4S0tlM+2qDSr9HWChF25c/B7YMMGa13vteftodlnl qzLw== 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=4sPhOJ2xyOwqJg9M6NIEIYnKrcjA5jcp/rLBizeOe6A=; fh=o/jSBnEq+q6f0RIvwQCm9vXYTY2ht4wko+kYqXvm+0E=; b=CZopy2i3nMMGqJfgmeljBPpsN+NxzNqYj9ivcCQACel3k4kpyRC6pwzvdjDDiAPEko eQyFHRfMcLaqytFXDzSthY3klw4w0yms6TRC1HrBjoShWuGUeFos36PHzAf1LB2sZgpS jUz8SsqWTlSKHuhlB7XqoErhe0BuPskBib7Z/D6gaL8AMxlkGFZG1KjYVN2pprD0NXem b8xAnDs3ORFnK38MEGHzjStaUdYPPHitt5tvh/R3mce/RnHDtOoRDicrnt3zyvA/jegM Yobj9oQsSDkrI+qXsYyUTTd7kjr282BGsOUZeVjWFc178+jCdBa4hQMZhR5kAKCO2TSV PmmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e4YosLmB; 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-7543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7543-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c16079csi73677935ad.543.2024.05.12.05.25.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 05:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e4YosLmB; 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-7543-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7543-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 175EF280FBB for ; Sun, 12 May 2024 12:25:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D2F1381DA; Sun, 12 May 2024 12:25:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="e4YosLmB" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 95C1E2E85A for ; Sun, 12 May 2024 12:25:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715516729; cv=none; b=TO21uuRA7muHq30H2atZe8Ym8GfVSe0yEjPny+aGWyVO5H8WniI/ffnU5fNKDPG5js3vgTDIGlSFMhNF8h8NE7YQynpQfeGb3aKQ9bTpDUk/xAXWW3bGGQMHYZAvySX8/LA0yS2ZUCx4qE+FJkcrW8ysxaUl6tAPuyYtFqBLFs0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715516729; c=relaxed/simple; bh=wUZ6FIYCOXAu91qm9QLqM/LXYIMYjd9gnvXcyCKLCcs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jCDOZ6hxs5BEImGb60zT4xZ+JpCSBivwA5QKk+E+dqoV29qNOGQw+vM4OsF/MVGIM+wc6yR/f2VghQTVy6r84YG19+MxoeCyOVmhrDFJBmVl7/0wE+yRUQhhOHCz2CbTKrHYKJVhMGo0Ep+mSd21IeXnzyjlgc2hfFXL26shUZU= 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=e4YosLmB; arc=none smtp.client-ip=198.175.65.21 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=1715516727; x=1747052727; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wUZ6FIYCOXAu91qm9QLqM/LXYIMYjd9gnvXcyCKLCcs=; b=e4YosLmBv7YnpCXdg0SNScE0zQZKuQMNk88A9SxlInpgaDdWQdg5t02/ JYQs/E/bSq+WpFOtJvgFtdYOGek3AERW2Yuc/SyU4c7DyTww/I7zSTxB8 LAdTHIYHuQjPRWGEeIaFKm0meDhXlY1W65ZUICMpgYvA3Br+xKiyEmzKZ K/WEXexRQuhXHixSi/cqtKpsUy3Cj1dKltEUdz2d7hdTJ6bhJT1S+2vfB AasTfapshQcS9r95EcXxICsUbP+eSzDnWzp/GoFW51EfnsxWHPBoiYJD0 Lec/iRE+xyN5cM5V0bKAF+fkLKSsMmwnlqVjAFPmBafEGOFLHEwvISC79 Q==; X-CSE-ConnectionGUID: x+RkkgQQRKuczQwesrVmtw== X-CSE-MsgGUID: BRlguBJ7Rm6rvSbTjPeT2g== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="11397207" X-IronPort-AV: E=Sophos;i="6.08,155,1712646000"; d="scan'208";a="11397207" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 05:25:27 -0700 X-CSE-ConnectionGUID: oh7MXoQuSAKIqVGgSUdqKA== X-CSE-MsgGUID: D+ESURsPQiaihdaRStzbIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,155,1712646000"; d="scan'208";a="34761330" Received: from weis0040.iil.intel.com ([10.12.217.108]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 05:25:26 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer , Johannes Berg Subject: [PATCH 08/14] wifi: iwlwifi: mvm: check n_ssids before accessing the ssids Date: Sun, 12 May 2024 15:25:01 +0300 Message-Id: <20240512152312.9b2ae544edc9.I5a0e6cc8f02050a766db704d15594c61fe583d45@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240512122507.3812527-1-miriam.rachel.korenblit@intel.com> References: <20240512122507.3812527-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 f81a9b7099be..9be812a40fd9 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -1313,7 +1313,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 @@ -1418,7 +1418,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