]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: iwlwifi: uefi: check DSM item validity
authorJohannes Berg <johannes.berg@intel.com>
Thu, 28 Aug 2025 06:55:28 +0000 (09:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:58:07 +0000 (18:58 +0200)
[ Upstream commit 1d33694462fa7da451846c39d653585b61375992 ]

The first array index is a bitmap indicating which of the
other values are valid. Check that bitmap before returning
a value.

Fixes: fc7214c3c986 ("wifi: iwlwifi: read DSM functions from UEFI")
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.59ec52ff865e.I9e11f497a029eb38f481b2c90c43c0935285216d@changeid
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/intel/iwlwifi/fw/uefi.c

index 86d6286a1537855f409787e20d6cee81184acaf2..e5fbb5fcc4abc975060d1bc068313720884b88e0 100644 (file)
@@ -741,6 +741,12 @@ int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func,
                goto out;
        }
 
+       if (!(data->functions[DSM_FUNC_QUERY] & BIT(func))) {
+               IWL_DEBUG_RADIO(fwrt, "DSM func %d not in 0x%x\n",
+                               func, data->functions[DSM_FUNC_QUERY]);
+               goto out;
+       }
+
        *value = data->functions[func];
        ret = 0;
 out: