linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: iwlwifi: Fix firmware version handling
@ 2025-11-13 22:28 Ville Syrjala
  2025-12-09  8:20 ` Ville Syrjälä
  0 siblings, 1 reply; 2+ messages in thread
From: Ville Syrjala @ 2025-11-13 22:28 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Miri Korenblit, Ville Syrjälä

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

On my system the arithmetic done on the firmware numbers
results in a negative number, but since the types are
unsigned it gets interpreted as a large positive number.

The end result is that the firmware gets rejected and wifi
is defunct.

Switch to signed types to handle this case correctly.

iwlwifi 0000:0c:00.0: Driver unable to support your firmware API. Driver supports FW core 4294967294..2, firmware is 2.
iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-4.ucode failed with error -2
iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-3.ucode failed with error -2
iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-2.ucode failed with error -2
iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-1.ucode failed with error -2
iwlwifi 0000:0c:00.0: no suitable firmware found!
iwlwifi 0000:0c:00.0: minimum version required: iwlwifi-5000-1
iwlwifi 0000:0c:00.0: maximum version supported: iwlwifi-5000-5
iwlwifi 0000:0c:00.0: check git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

Cc: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Fixes: 5f708cccde9d ("wifi: iwlwifi: add a new FW file numbering scheme")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 607fcea6f4ef..0f002ef261fc 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1599,7 +1599,7 @@ static void _iwl_op_mode_stop(struct iwl_drv *drv)
  */
 static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
 {
-	unsigned int min_core, max_core, loaded_core;
+	int min_core, max_core, loaded_core;
 	struct iwl_drv *drv = context;
 	struct iwl_fw *fw = &drv->fw;
 	const struct iwl_ucode_header *ucode;
@@ -1678,7 +1678,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
 	if (loaded_core < min_core || loaded_core > max_core) {
 		IWL_ERR(drv,
 			"Driver unable to support your firmware API. "
-			"Driver supports FW core %u..%u, firmware is %u.\n",
+			"Driver supports FW core %d..%d, firmware is %d.\n",
 			min_core, max_core, loaded_core);
 		goto try_again;
 	}
-- 
2.49.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wifi: iwlwifi: Fix firmware version handling
  2025-11-13 22:28 [PATCH] wifi: iwlwifi: Fix firmware version handling Ville Syrjala
@ 2025-12-09  8:20 ` Ville Syrjälä
  0 siblings, 0 replies; 2+ messages in thread
From: Ville Syrjälä @ 2025-12-09  8:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Miri Korenblit

On Fri, Nov 14, 2025 at 12:28:52AM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> On my system the arithmetic done on the firmware numbers
> results in a negative number, but since the types are
> unsigned it gets interpreted as a large positive number.
> 
> The end result is that the firmware gets rejected and wifi
> is defunct.
> 
> Switch to signed types to handle this case correctly.
> 
> iwlwifi 0000:0c:00.0: Driver unable to support your firmware API. Driver supports FW core 4294967294..2, firmware is 2.
> iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-4.ucode failed with error -2
> iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-3.ucode failed with error -2
> iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-2.ucode failed with error -2
> iwlwifi 0000:0c:00.0: Direct firmware load for iwlwifi-5000-1.ucode failed with error -2
> iwlwifi 0000:0c:00.0: no suitable firmware found!
> iwlwifi 0000:0c:00.0: minimum version required: iwlwifi-5000-1
> iwlwifi 0000:0c:00.0: maximum version supported: iwlwifi-5000-5
> iwlwifi 0000:0c:00.0: check git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
> 
> Cc: linux-wireless@vger.kernel.org
> Cc: Johannes Berg <johannes.berg@intel.com>
> Cc: Miri Korenblit <miriam.rachel.korenblit@intel.com>
> Fixes: 5f708cccde9d ("wifi: iwlwifi: add a new FW file numbering scheme")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

This regression is now in 6.18.

Cc: stable@vger.kernel.org

> ---
>  drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> index 607fcea6f4ef..0f002ef261fc 100644
> --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> @@ -1599,7 +1599,7 @@ static void _iwl_op_mode_stop(struct iwl_drv *drv)
>   */
>  static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
>  {
> -	unsigned int min_core, max_core, loaded_core;
> +	int min_core, max_core, loaded_core;
>  	struct iwl_drv *drv = context;
>  	struct iwl_fw *fw = &drv->fw;
>  	const struct iwl_ucode_header *ucode;
> @@ -1678,7 +1678,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
>  	if (loaded_core < min_core || loaded_core > max_core) {
>  		IWL_ERR(drv,
>  			"Driver unable to support your firmware API. "
> -			"Driver supports FW core %u..%u, firmware is %u.\n",
> +			"Driver supports FW core %d..%d, firmware is %d.\n",
>  			min_core, max_core, loaded_core);
>  		goto try_again;
>  	}
> -- 
> 2.49.1

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-09  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 22:28 [PATCH] wifi: iwlwifi: Fix firmware version handling Ville Syrjala
2025-12-09  8:20 ` Ville Syrjälä

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).