From patchwork Sun Aug 25 16:17:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 823127 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 F0C6816EC0E for ; Sun, 25 Aug 2024 16:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724602652; cv=none; b=VVQq38twtkhAuakPN+w2/0VGrto0Kh0XEUOo99fq2ftNwyNDY6Mrc0F0ygGvTTnfkisXTFR6qDw8hyuaolwC4WVduCVuj+vkYoUPaeUYbK5baVdtxpqzwqLDLSypr5EZfVnDeHuAdFT7BDL8dO0XPipChqNu++1SG80H81j76+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724602652; c=relaxed/simple; bh=fJKK3Ij6AJ65NLokDieLiXU7tz2fTPxoxhuX1jQXE/w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Idh0NbS0yBNigG9qP/Rar2rjPQfFYk5x7ddSMjUF+cNiN6kOWmESaCKCH1XlIlrs7i7J2NXNpPvWuwgvSGDkSxRQCy9WfN7K/Pb0J7WN5oDmd3gSOIvZXioQzVkzAxTXH0OT2na3nHWyvkk3j7JSJqhbe8UZkiLueeAzOKR0zAE= 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=UjHeTsgM; arc=none smtp.client-ip=192.198.163.18 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UjHeTsgM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724602651; x=1756138651; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fJKK3Ij6AJ65NLokDieLiXU7tz2fTPxoxhuX1jQXE/w=; b=UjHeTsgM+gsthK1lWpvYVzeO4BQ3qMwcmgE2Y1QRfsC/RDzhMKJ3nkzh 75wjrNkWVj7aQIgop4VFrrwfJntBSRUvFVu2NzDKtPmcXBsG+Z2v/abha qLSM70bcjoXlLBSLUC89FTzQc76fwywiysuZvtQsev3T8ZAHMvVb3P3+z nalqEZaOSAc5lnK+tFEF9JmfkIOqNeVgsOrU/9PiaTEAYLFsbkfMSPXIH 0Db7a/NFeNdGGoHSOmP7MHxovnGRJVJzK3CXh8mvzbfuBCSrGE4xOjP35 4PaWdZqY53SdTjpegaEthVZvvbnZwYoQGhMwFf9+iaWx3Uo4CIFc/V+Lx g==; X-CSE-ConnectionGUID: FjLsm8BaRO6bMDvmXhjCKg== X-CSE-MsgGUID: /TDvRmgGQ1yJ5lT+pcLFcw== X-IronPort-AV: E=McAfee;i="6700,10204,11175"; a="22544125" X-IronPort-AV: E=Sophos;i="6.10,175,1719903600"; d="scan'208";a="22544125" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2024 09:17:30 -0700 X-CSE-ConnectionGUID: 9U2E7YmHSzOsOkTRkjpXcQ== X-CSE-MsgGUID: 4eUK4lJMQea6Eh5ctP1s5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,175,1719903600"; d="scan'208";a="62999741" Received: from weis0040.iil.intel.com ([10.12.217.108]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2024 09:17:29 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Daniel Gabay , Ilan Peer Subject: [PATCH 05/13] wifi: iwlwifi: mvm: fix iwl_mvm_scan_fits() calculation Date: Sun, 25 Aug 2024 19:17:05 +0300 Message-Id: <20240825191257.7db825442fd2.I99f4d6587709de02072fd57957ec7472331c6b1d@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240825161713.3547021-1-miriam.rachel.korenblit@intel.com> References: <20240825161713.3547021-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 From: Daniel Gabay The calculation should consider also the 6GHz IE's len, fix that. In addition, in iwl_mvm_sched_scan_start() the scan_fits helper is called only in case non_psc_incldued is true, but it should be called regardless, fix that as well. Signed-off-by: Daniel Gabay Reviewed-by: Ilan Peer Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 8e0df31f1b3e..ecd9d301e88b 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c @@ -837,8 +837,8 @@ static inline bool iwl_mvm_scan_fits(struct iwl_mvm *mvm, int n_ssids, return ((n_ssids <= PROBE_OPTION_MAX) && (n_channels <= mvm->fw->ucode_capa.n_scan_channels) & (ies->common_ie_len + - ies->len[NL80211_BAND_2GHZ] + - ies->len[NL80211_BAND_5GHZ] <= + ies->len[NL80211_BAND_2GHZ] + ies->len[NL80211_BAND_5GHZ] + + ies->len[NL80211_BAND_6GHZ] <= iwl_mvm_max_scan_ie_fw_cmd_room(mvm))); } @@ -3168,18 +3168,16 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, params.n_channels = j; } - if (non_psc_included && - !iwl_mvm_scan_fits(mvm, req->n_ssids, ies, params.n_channels)) { - kfree(params.channels); - return -ENOBUFS; + if (!iwl_mvm_scan_fits(mvm, req->n_ssids, ies, params.n_channels)) { + ret = -ENOBUFS; + goto out; } uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, ¶ms, type); - - if (non_psc_included) - kfree(params.channels); - if (uid < 0) - return uid; + if (uid < 0) { + ret = uid; + goto out; + } ret = iwl_mvm_send_cmd(mvm, &hcmd); if (!ret) { @@ -3197,6 +3195,9 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm, mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; } +out: + if (non_psc_included) + kfree(params.channels); return ret; }