Skip to content

Commit 92549cd

Browse files
axboeKalle Valo
authored andcommitted
iwlwifi: fix kernel crash when unregistering thermal zone
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. Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 7195439 commit 92549cd

File tree

1 file changed

+8
-4
lines changed
  • drivers/net/wireless/intel/iwlwifi/mvm

1 file changed

+8
-4
lines changed

drivers/net/wireless/intel/iwlwifi/mvm/tt.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,10 @@ static void iwl_mvm_thermal_zone_unregister(struct iwl_mvm *mvm)
843843
return;
844844

845845
IWL_DEBUG_TEMP(mvm, "Thermal zone device unregister\n");
846-
thermal_zone_device_unregister(mvm->tz_device.tzone);
847-
mvm->tz_device.tzone = NULL;
846+
if (mvm->tz_device.tzone) {
847+
thermal_zone_device_unregister(mvm->tz_device.tzone);
848+
mvm->tz_device.tzone = NULL;
849+
}
848850
}
849851

850852
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)
853855
return;
854856

855857
IWL_DEBUG_TEMP(mvm, "Cooling device unregister\n");
856-
thermal_cooling_device_unregister(mvm->cooling_dev.cdev);
857-
mvm->cooling_dev.cdev = NULL;
858+
if (mvm->cooling_dev.cdev) {
859+
thermal_cooling_device_unregister(mvm->cooling_dev.cdev);
860+
mvm->cooling_dev.cdev = NULL;
861+
}
858862
}
859863
#endif /* CONFIG_THERMAL */
860864

0 commit comments

Comments
 (0)