All of lore.kernel.org
 help / color / mirror / Atom feed
* iwlwifi: fix kernel crash when unregistering thermal zone
@ 2017-01-17 22:22 Jens Axboe
  2017-01-21  7:56 ` Kalle Valo
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jens Axboe @ 2017-01-17 22:22 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

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>

---

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...

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 63a051be832e..bec7d9c46087 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -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 */

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

* Re: iwlwifi: fix kernel crash when unregistering thermal zone
  2017-01-17 22:22 iwlwifi: fix kernel crash when unregistering thermal zone Jens Axboe
@ 2017-01-21  7:56 ` Kalle Valo
  2017-01-21 12:59 ` Kalle Valo
       [not found] ` <20170121125917.2E08F609D0@smtp.codeaurora.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2017-01-21  7:56 UTC (permalink / raw)
  To: Jens Axboe, Luca Coelho; +Cc: Johannes Berg, linux-wireless

Jens Axboe <axboe@kernel.dk> writes:

> 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>
>
> ---
>
> 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.

-- 
Kalle Valo

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

* Re: iwlwifi: fix kernel crash when unregistering thermal zone
  2017-01-17 22:22 iwlwifi: fix kernel crash when unregistering thermal zone Jens Axboe
  2017-01-21  7:56 ` Kalle Valo
@ 2017-01-21 12:59 ` Kalle Valo
       [not found] ` <20170121125917.2E08F609D0@smtp.codeaurora.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2017-01-21 12:59 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Johannes Berg, linux-wireless

Jens Axboe <axboe@kernel.dk> wrote:
> 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>

Patch applied to wireless-drivers.git, thanks.

92549cdc288f iwlwifi: fix kernel crash when unregistering thermal zone

-- 
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

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

* Re: iwlwifi: fix kernel crash when unregistering thermal zone
       [not found] ` <20170121125917.2E08F609D0@smtp.codeaurora.org>
@ 2017-01-27 19:48   ` Jens Axboe
  2017-01-27 19:54     ` Kalle Valo
  0 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2017-01-27 19:48 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Johannes Berg, linux-wireless

On 01/21/2017 05:59 AM, Kalle Valo wrote:
> Jens Axboe <axboe@kernel.dk> wrote:
>> 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>
> 
> Patch applied to wireless-drivers.git, thanks.
> 
> 92549cdc288f iwlwifi: fix kernel crash when unregistering thermal zone

When is this going out?

-- 
Jens Axboe

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

* Re: iwlwifi: fix kernel crash when unregistering thermal zone
  2017-01-27 19:48   ` Jens Axboe
@ 2017-01-27 19:54     ` Kalle Valo
  2017-01-27 19:55       ` Jens Axboe
  0 siblings, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2017-01-27 19:54 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Johannes Berg, linux-wireless

Jens Axboe <axboe@kernel.dk> writes:

> On 01/21/2017 05:59 AM, Kalle Valo wrote:
>> Jens Axboe <axboe@kernel.dk> wrote:
>>> 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>
>> 
>> 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.

-- 
Kalle Valo

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

* Re: iwlwifi: fix kernel crash when unregistering thermal zone
  2017-01-27 19:54     ` Kalle Valo
@ 2017-01-27 19:55       ` Jens Axboe
  0 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2017-01-27 19:55 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Johannes Berg, linux-wireless

On 01/27/2017 12:54 PM, Kalle Valo wrote:
> Jens Axboe <axboe@kernel.dk> writes:
> 
>> On 01/21/2017 05:59 AM, Kalle Valo wrote:
>>> Jens Axboe <axboe@kernel.dk> wrote:
>>>> 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>
>>>
>>> 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!

-- 
Jens Axboe

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

* Re: iwlwifi: fix kernel crash when unregistering thermal zone
  2017-01-21 10:54 Coelho, Luciano
@ 2017-01-21 11:22 ` Kalle Valo
  0 siblings, 0 replies; 8+ messages in thread
From: Kalle Valo @ 2017-01-21 11:22 UTC (permalink / raw)
  To: Coelho, Luciano; +Cc: linux-wireless, Berg, Johannes, axboe

"Coelho, Luciano" <luciano.coelho@intel.com> writes:

> On Jan 21, 2017 09:56, Kalle Valo <kvalo@codeaurora.org> wrote:
> Jens Axboe <axboe@kernel.dk> writes: 
>> > 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> 
>> > 
>> > --- 
>> > 
>> > 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.
>
> Yes, please go ahead and take it directly.
>
> Acked-by: Luca Coelho <luciano.coelho@intel.com>

Thanks, I'll apply it soon.

-- 
Kalle Valo

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

* Re: iwlwifi: fix kernel crash when unregistering thermal zone
@ 2017-01-21 10:54 Coelho, Luciano
  2017-01-21 11:22 ` Kalle Valo
  0 siblings, 1 reply; 8+ messages in thread
From: Coelho, Luciano @ 2017-01-21 10:54 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, Coelho, Luciano, Berg, Johannes, axboe

KHJlc2VuZGluZywgc29ycnkgZm9yIHRoZSBIVE1MIHZlcnNpb24gbXkgcGhvbmUgZGVjaWRlZCB0
byB1c2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aGUgZHJpdmVyLiBS
aWdodCBub3cgSSBjYW4ndCwgc2luY2UgaXQgY3Jhc2hlcy4uLiANCj4gDQo+IEx1Y2EsIGNhbiBJ
IHRha2UgdGhpcyBkaXJlY3RseSB0byB3aXJlbGVzcy1kcml2ZXJzPyBUaGlzIGlzIGFuIGltcG9y
dGFudCANCj4gZml4IGFuZCB3ZSBzaG91bGQgZ2V0IGl0IHRvIExpbnVzJyB0cmVlIEFTQVAuDQoN
ClllcywgcGxlYXNlIGdvIGFoZWFkIGFuZCB0YWtlIGl0IGRpcmVjdGx5Lg0KDQpBY2tlZC1ieTog
THVjYSBDb2VsaG8gPGx1Y2lhbm8uY29lbGhvQGludGVsLmNvbT4NCg0KVGhhbmtzIQ0KDQotLQ0K
Q2hlZXJzLA0KTHVjYS4=

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

end of thread, other threads:[~2017-01-27 20:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-17 22:22 iwlwifi: fix kernel crash when unregistering thermal zone Jens Axboe
2017-01-21  7:56 ` Kalle Valo
2017-01-21 12:59 ` Kalle Valo
     [not found] ` <20170121125917.2E08F609D0@smtp.codeaurora.org>
2017-01-27 19:48   ` Jens Axboe
2017-01-27 19:54     ` Kalle Valo
2017-01-27 19:55       ` Jens Axboe
2017-01-21 10:54 Coelho, Luciano
2017-01-21 11:22 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.