mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 04:29:11 -04:00
wifi: iwlwifi: acpi: check DSM func validity
The DSM func 0 (DSM_FUNC_QUERY) returns a bitmap of which
other functions contain valid data, query and check it
before returning other functions data.
Fixes: 9db93491f2 ("iwlwifi: acpi: support device specific method (DSM)")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220085
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250828095500.881e17ff8f6a.Ic6d92997d9d5fad127919d6e1b830cd3fe944468@changeid
This commit is contained in:
committed by
Miri Korenblit
parent
224476613c
commit
7bf2dfccc2
@@ -169,7 +169,7 @@ int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
|
||||
|
||||
BUILD_BUG_ON(ARRAY_SIZE(acpi_dsm_size) != DSM_FUNC_NUM_FUNCS);
|
||||
|
||||
if (WARN_ON(func >= ARRAY_SIZE(acpi_dsm_size)))
|
||||
if (WARN_ON(func >= ARRAY_SIZE(acpi_dsm_size) || !func))
|
||||
return -EINVAL;
|
||||
|
||||
expected_size = acpi_dsm_size[func];
|
||||
@@ -178,6 +178,29 @@ int iwl_acpi_get_dsm(struct iwl_fw_runtime *fwrt,
|
||||
if (expected_size != sizeof(u8) && expected_size != sizeof(u32))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (!fwrt->acpi_dsm_funcs_valid) {
|
||||
ret = iwl_acpi_get_dsm_integer(fwrt->dev, ACPI_DSM_REV,
|
||||
DSM_FUNC_QUERY,
|
||||
&iwl_guid, &tmp,
|
||||
acpi_dsm_size[DSM_FUNC_QUERY]);
|
||||
if (ret) {
|
||||
/* always indicate BIT(0) to avoid re-reading */
|
||||
fwrt->acpi_dsm_funcs_valid = BIT(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
IWL_DEBUG_RADIO(fwrt, "ACPI DSM validity bitmap 0x%x\n",
|
||||
(u32)tmp);
|
||||
/* always indicate BIT(0) to avoid re-reading */
|
||||
fwrt->acpi_dsm_funcs_valid = tmp | BIT(0);
|
||||
}
|
||||
|
||||
if (!(fwrt->acpi_dsm_funcs_valid & BIT(func))) {
|
||||
IWL_DEBUG_RADIO(fwrt, "ACPI DSM %d not indicated as valid\n",
|
||||
func);
|
||||
return -ENODATA;
|
||||
}
|
||||
|
||||
ret = iwl_acpi_get_dsm_integer(fwrt->dev, ACPI_DSM_REV, func,
|
||||
&iwl_guid, &tmp, expected_size);
|
||||
if (ret)
|
||||
|
||||
@@ -113,6 +113,10 @@ struct iwl_txf_iter_data {
|
||||
* @phy_filters: specific phy filters as read from WPFC BIOS table
|
||||
* @ppag_bios_rev: PPAG BIOS revision
|
||||
* @ppag_bios_source: see &enum bios_source
|
||||
* @acpi_dsm_funcs_valid: bitmap indicating which DSM values are valid,
|
||||
* zero (default initialization) means it hasn't been read yet,
|
||||
* and BIT(0) is set when it has since function 0 also has this
|
||||
* bitmap and is always supported
|
||||
*/
|
||||
struct iwl_fw_runtime {
|
||||
struct iwl_trans *trans;
|
||||
@@ -189,6 +193,10 @@ struct iwl_fw_runtime {
|
||||
bool uats_valid;
|
||||
u8 uefi_tables_lock_status;
|
||||
struct iwl_phy_specific_cfg phy_filters;
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
u32 acpi_dsm_funcs_valid;
|
||||
#endif
|
||||
};
|
||||
|
||||
void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
|
||||
|
||||
Reference in New Issue
Block a user