Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2367103lqp; Sun, 24 Mar 2024 16:04:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxmEKtu+sHHJvqmcAMqDckpW370jhrNLFqh0YV13DR7BSZsYxcoGTTjoIalFloAprTcInbO1HDugJj9PqEOvmClUyZTQt2ZmUs9JvR3A== X-Google-Smtp-Source: AGHT+IGK6Fdz/1+MfHuQo3nD8gG+UcniAm03Hocf3UmwtJUYIAgKVJsn3A+sIO6+zr/zhnrnw3Xd X-Received: by 2002:a17:902:cccd:b0:1dd:96dc:dbad with SMTP id z13-20020a170902cccd00b001dd96dcdbadmr6375084ple.22.1711321485264; Sun, 24 Mar 2024 16:04:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711321485; cv=pass; d=google.com; s=arc-20160816; b=f3oZ9kP8TsjYGZdjU78FMFP5hcUHPlXd4D+uaG+2L4j7Ta5qTrcI2wN04EQfmSwqB0 loSUWavjn57rtBgjrq2/2hzym3WmudngLa3O2ImXvz6QbLP+I7g78L1ikI/+VPOcVOzI Z3ZNnB66N8uR6vBygO1lB+zMrgv33xiE2T3S3f4Vir0kVUW23PBcgapMUyP3bc6P/zzc 9v1c6dXrrs5u8P8c6NfKGx1tFAX/m3q60smE13F2+Z4sZEuWqk8dkBquNE6a/P57svIT vteDs0dQFXDllKhJwDZ5h2bdB4abE2fyGiqJoXUWycqDp5LOoB6+ZSv8pTEVzruZJH/r y2TA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=G8wtJ4KFuDkD5czyRk5bNvIdLZwGOJ6YbOVfBmdG7xM=; fh=Kp7oK3kGLCVCYOuqKpKbs4yjYdlXTqbAXzgPymPRF2E=; b=dniHEgdcuz6rXTbkSEHm00GrXKlnn7G0tycglm0FWcYOrAcD+a3Q6tAlhv387NXxWw +9BTsNCGc2vBTfvJA4XnCgc9TdErf0cjqto5I1nXAcNuVT05edTmB7/o+XaSqI+h1rRp 2WGFl5FBlsUlLVI9uChttzdOpFQUXGE7iOkYNdHFA6hqg82Obo7QpeGMJylAt//vFSGM nfs6W0Rv5Pa/PDoOHMS8fILma/dUtvenIzPJ6NHK3XTN/ALXoOCwEBhC/0im6EDEOtcS XbP2Rv+YMNuUe3zYwDufE8BiQi032f0gR0i3tVaUGI6QdN3YkcRNYeoFf6uvuBglwY3O gGKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o5vHsjiM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f12-20020a17090274cc00b001e09e799861si3872902plt.606.2024.03.24.16.04.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:04:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113014-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=@kernel.org header.s=k20201202 header.b=o5vHsjiM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113014-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 E73BB281B2F for ; Sun, 24 Mar 2024 23:04:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 183FF13664F; Sun, 24 Mar 2024 22:37:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o5vHsjiM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2A0AB1350E3; Sun, 24 Mar 2024 22:37:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319825; cv=none; b=C1RX5sPooUt2GxMRBXiu7nF4Y3h9gOk1xfIEDkm/QuXXHK8MCWDEaQNEP7OmqY7xWG85c1yvfPEe0cihmBrGUH2FaOk2INic7HQ/PWd8zw9WifCgdh5IJDtoieGCdbv5n6NtiQ3ur6WrCOumMCc+QdqFkSlt2cLSrDaX00NVFBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319825; c=relaxed/simple; bh=Q33wawuXrNE4Ttm2focUd5VKY7etrwROUKCZsilVbIM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bVC9SbOQ369rSghZN5zLMAmbgSNBpcsMTZCPHQa7MUyjxOzMczB7soX3dqfO7HRDmvnpxrznFSwv5r9JvZRatJmC6jjDm8pg8xkWSaTQUuIZKrxzoSKIqP0GKm3SzZ0JZ9M9EuCm5KSXSUxSk18cJ1F2S6VdE0CjIay/abUs+EM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o5vHsjiM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53958C43390; Sun, 24 Mar 2024 22:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319825; bh=Q33wawuXrNE4Ttm2focUd5VKY7etrwROUKCZsilVbIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o5vHsjiMOiNdW1xVZ1LBZUt0tjYteR+t2urmZPBIOG7edJcdgdSl8yVn/JYZ/s2Xu oCLs7VKcN5y5h7ipEqwjB0LuC0mxHVAmqIoUuUqQVi1PfLij3yRNlpnqrsW+e9K8TS /BpezmnfC4cBWmTaR38mptk2z1FCm37DKVL5d5bMBUQc+IcisK2Wpi7w4aVBlD6oLs Z/e5fiHBPLjdzmpPvXpE/Pft+RawYd/q4RVp2Sy+qzlJcnDqnoGY8lc+v32nt1l5RN uD9teu3AELCmSBwGI7UD0RQX1rXZMehgO+A5YyIRfcl7EuMBW832ZQlcx7cSdqONUq xizDP0zJeFfAA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Miri Korenblit , Gregory Greenman Gregory , Sasha Levin Subject: [PATCH 6.8 127/715] wifi: iwlwifi: acpi: fix WPFC reading Date: Sun, 24 Mar 2024 18:25:06 -0400 Message-ID: <20240324223455.1342824-128-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Johannes Berg [ Upstream commit 296f3e926716ded8dc29e349d2b042b362f96515 ] The code reading the WPFC table needs to take into account the domain type (first element in the package), shouldn't leak the memory if it fails, and has a bad comment. Fix all these issues. Fixes: c4c954547755 ("wifi: iwlwifi: implement WPFC ACPI table loading") Reported-by: Miri Korenblit Signed-off-by: Johannes Berg Reviewed-by: Gregory Greenman Gregory Link: https://msgid.link/20240128084842.2afeb476b62d.I200568dc42a277e21c12be99d5aaa39b009d45da@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 10 +++++----- drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c index dcc4810cb3247..f6ee5afb3320e 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c @@ -1296,7 +1296,6 @@ void iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt, if (IS_ERR(data)) return; - /* try to read wtas table revision 1 or revision 0*/ wifi_pkg = iwl_acpi_get_wifi_pkg(fwrt->dev, data, ACPI_WPFC_WIFI_DATA_SIZE, &tbl_rev); @@ -1306,13 +1305,14 @@ void iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt, if (tbl_rev != 0) goto out_free; - BUILD_BUG_ON(ARRAY_SIZE(filters->filter_cfg_chains) != ACPI_WPFC_WIFI_DATA_SIZE); + BUILD_BUG_ON(ARRAY_SIZE(filters->filter_cfg_chains) != + ACPI_WPFC_WIFI_DATA_SIZE - 1); for (i = 0; i < ARRAY_SIZE(filters->filter_cfg_chains); i++) { - if (wifi_pkg->package.elements[i].type != ACPI_TYPE_INTEGER) - return; + if (wifi_pkg->package.elements[i + 1].type != ACPI_TYPE_INTEGER) + goto out_free; tmp.filter_cfg_chains[i] = - cpu_to_le32(wifi_pkg->package.elements[i].integer.value); + cpu_to_le32(wifi_pkg->package.elements[i + 1].integer.value); } IWL_DEBUG_RADIO(fwrt, "Loaded WPFC filter config from ACPI\n"); diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h index e9277f6f35821..39106ccb4b9b6 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h @@ -56,7 +56,7 @@ #define ACPI_EWRD_WIFI_DATA_SIZE_REV2 ((ACPI_SAR_PROFILE_NUM - 1) * \ ACPI_SAR_NUM_CHAINS_REV2 * \ ACPI_SAR_NUM_SUB_BANDS_REV2 + 3) -#define ACPI_WPFC_WIFI_DATA_SIZE 4 /* 4 filter config words */ +#define ACPI_WPFC_WIFI_DATA_SIZE 5 /* domain and 4 filter config words */ /* revision 0 and 1 are identical, except for the semantics in the FW */ #define ACPI_GEO_NUM_BANDS_REV0 2 -- 2.43.0