Skip to contentSkip to conversation

iwlwifi: fix kernel crash when unregistering thermal zone

PATCH Jens Axboe 2 participants 6 messages Jan 17, 2017 – Jan 27, 2017 1 message not in the archive Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

A recent firmware change seems to have enabled thermal zones on the iwlwifi driver. Unfortunately, my device fails when registering the thermal zone. This doesn't stop the driver from attempting to unregister the thermal zone at unload time, triggering a NULL pointer deference in strlen() off the thermal_zone_device_unregister() path.

Don't unregister if name is NULL, for that case we failed registering. Do the same for the cooling zone.

---

Would be great if this could go into the current series, as sometimes I have to reload the driver. Right now I can't, since it crashes...

drivers/net/wireless/intel/iwlwifi/mvm/tt.c +8 -4
index 63a051be832e..bec7d9c46087 100644
@@ -843,8 +843,10 @@ static void iwl_mvm_thermal_zone_unregister(struct iwl_mvm *mvm)
 		return;
 
 	IWL_DEBUG_TEMP(mvm, "Thermal zone device unregister\n");
-	thermal_zone_device_unregister(mvm->tz_device.tzone);
-	mvm->tz_device.tzone = NULL;
+	if (mvm->tz_device.tzone) {
+		thermal_zone_device_unregister(mvm->tz_device.tzone);
+		mvm->tz_device.tzone = NULL;
+	}
 }
 
 static void iwl_mvm_cooling_device_unregister(struct iwl_mvm *mvm)
@@ -853,8 +855,10 @@ static void iwl_mvm_cooling_device_unregister(struct iwl_mvm *mvm)
 		return;
 
 	IWL_DEBUG_TEMP(mvm, "Cooling device unregister\n");
-	thermal_cooling_device_unregister(mvm->cooling_dev.cdev);
-	mvm->cooling_dev.cdev = NULL;
+	if (mvm->cooling_dev.cdev) {
+		thermal_cooling_device_unregister(mvm->cooling_dev.cdev);
+		mvm->cooling_dev.cdev = NULL;
+	}
 }
 #endif /* CONFIG_THERMAL */
#1 lore raw
Quoted 9 lines · Jens Axboe

A recent firmware change seems to have enabled thermal zones on the iwlwifi driver. Unfortunately, my device fails when registering the thermal zone. This doesn't stop the driver from attempting to unregister the thermal zone at unload time, triggering a NULL pointer deference in strlen() off the thermal_zone_device_unregister() path.

Don't unregister if name is NULL, for that case we failed registering. Do the same for the cooling zone.

Quoted 6 lines

---

Would be great if this could go into the current series, as sometimes I have to reload the driver. Right now I can't, since it crashes...

Luca, can I take this directly to wireless-drivers? This is an important fix and we should get it to Linus' tree ASAP.

Signature · 1 line
Kalle Valo
#2 lore raw
In reply to Jens Axboe
Quoted 10 lines · Jens Axboe

A recent firmware change seems to have enabled thermal zones on the iwlwifi driver. Unfortunately, my device fails when registering the thermal zone. This doesn't stop the driver from attempting to unregister the thermal zone at unload time, triggering a NULL pointer deference in strlen() off the thermal_zone_device_unregister() path.

Don't unregister if name is NULL, for that case we failed registering. Do the same for the cooling zone.

Patch applied to wireless-drivers.git, thanks.

92549cdc288f iwlwifi: fix kernel crash when unregistering thermal zone

Signature · 6 lines
https://patchwork.kernel.org/patch/9522187/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 7 lines · Kalle Valo
Quoted 6 lines · Jens Axboe

A recent firmware change seems to have enabled thermal zones on the iwlwifi driver. Unfortunately, my device fails when registering the thermal zone. This doesn't stop the driver from attempting to unregister the thermal zone at unload time, triggering a NULL pointer deference in strlen() off the thermal_zone_device_unregister() path.

Quoted 8 lines
Quoted 4 lines

Don't unregister if name is NULL, for that case we failed registering. Do the same for the cooling zone.

Patch applied to wireless-drivers.git, thanks.

92549cdc288f iwlwifi: fix kernel crash when unregistering thermal zone

When is this going out?

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 11 lines · Jens Axboe
Quoted 10 lines · Kalle Valo
Quoted 9 lines · Jens Axboe

A recent firmware change seems to have enabled thermal zones on the iwlwifi driver. Unfortunately, my device fails when registering the thermal zone. This doesn't stop the driver from attempting to unregister the thermal zone at unload time, triggering a NULL pointer deference in strlen() off the thermal_zone_device_unregister() path.

Don't unregister if name is NULL, for that case we failed registering. Do the same for the cooling zone.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Patch applied to wireless-drivers.git, thanks.

92549cdc288f iwlwifi: fix kernel crash when unregistering thermal zone

When is this going out?

Trying to send a pull request to Dave tomorrow.

Signature · 1 line
Kalle Valo
author
#6 lore raw
Quoted 15 lines · Kalle Valo
Quoted 13 lines · Jens Axboe
Quoted 12 lines · Kalle Valo
Quoted 10 lines · Jens Axboe

A recent firmware change seems to have enabled thermal zones on the iwlwifi driver. Unfortunately, my device fails when registering the thermal zone. This doesn't stop the driver from attempting to unregister the thermal zone at unload time, triggering a NULL pointer deference in strlen() off the thermal_zone_device_unregister() path.

Don't unregister if name is NULL, for that case we failed registering. Do the same for the cooling zone.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Patch applied to wireless-drivers.git, thanks.

92549cdc288f iwlwifi: fix kernel crash when unregistering thermal zone

When is this going out?

Trying to send a pull request to Dave tomorrow.

Great, thanks!

Signature · 1 line
Jens Axboe