Skip to contentSkip to conversation

iwlwifi:dvm:Return false if resume command data is not same size as received packet for the function iwl_resume_status_fn

PATCH Grumbach, Emmanuel 1 participant 2 messages Jun 10, 2015 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

T24gV2VkLCAyMDE1LTA2LTEwIGF0IDEyOjMzIC0wNDAwLCBOaWNob2xhcyBLcmF1c2Ugd3JvdGU6 DQo+IFRoaXMgbWFrZXMgdGhlIGZ1bmN0aW9uIGl3bF9yZXN1bWVfc3RhdHVzX2ZuIHJldHVybiBm YWxzZSBub3cgaWYNCj4gdGhlIHJlY2VpdmVkIHBhY2tldCBvZiB0eXBlIGl3bF9yeF9wYWNrZXQg aXMgbm90IHRoZSBzYW1lIHNpemUNCj4gYXMgdGhlIHN0cnVjdHVyZSBwb2ludGVyLCBpd2xfcmVz dW1lX2RhdGEncyBjbWQgZWxlbWVudCBpbiBvcmRlcg0KPiB0byBzaWduYWwgY2FsbGVycyBhYm91 dCB0aGlzIGVycm9yIGFuZCBhbGxvdyB0aGVtIHRvIGhhbmRsZSBpdA0KPiBvY2N1cnJlbnRseS4N Cj4gDQoNCkhtLi4uIERpZCB5b3UgYWN0dWFsbHkgaGl0IHRoaXMgaWY/DQpJIGFtIG5vdCBzdXJl IEkgcmVhbGx5IHdhbnQgdG8gd2FpdCBoZXJlICh3aGljaCBpcyB3aGF0IHdpbGwgaGFwcGVuIGlm DQp5b3UgcmV0dXJuIGZhbHNlKSB3aGVuIHdlIGdldCBhbiB1bmV4cGVjdGVkIGxlbmd0aD8gSSBk byBub3QgZXhwZWN0DQphbnl0aGluZyBiZXNpZGVzIHRoZSByZXNwb25zZSBJIGFtIHdhaXRpbmcg Zm9yIHNpbmNlIHRoZSBmaXJtd2FyZSBpcw0KaGFuZGxpbmcgdGhlIEdFVF9TVEFUVVMgKm9ubHkq IC0gaXQganVzdCBjYW1lIGJhY2sgZnJvbSBXb1dMQU4uIEJvdHRvbQ0KbGluZSwgdGh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lyZXR1cm4gZmFsc2U7DQo+ ICAJfQ0KPiAgCW1lbWNweShyZXN1bWVfZGF0YS0+Y21kLCBwa3QtPmRhdGEsIHNpemVvZigqcmVz dW1lX2RhdGEtPmNtZCkpOw0KPiAgCXJlc3VtZV9kYXRhLT52YWxpZCA9IHRydWU7DQoNCg== --
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to a message not in the archive
Quoted 20 lines · Nicholas Krause
Quoted 8 lines · Emmanuel
Quoted 6 lines · Nicholas Krause

This makes the function iwl_resume_status_fn return false now if the received packet of type iwl_rx_packet is not the same size as the structure pointer, iwl_resume_data's cmd element in order to signal callers about this error and allow them to handle it occurrently.

Quoted 10 lines

Hm... Did you actually hit this if?
I am not sure I really want to wait here (which is what will happen if you return false) when we get an unexpected length? I do not expect anything besides the response I am waiting for since the firmware is handling the GET_STATUS *only* - it just came back from WoWLAN. Bottom line, this is really an error path and I prefer to exit and not wait for
the timeout in that case.
But I might be missing something?

Quoted 2 lines

Why not wait for the time out? Seems there is no reason not to and in that case if the firmware handles this

I doubt it will. This goes back to my original question: did you really hit this path? Does the patch solves a real bug you faced?

Quoted 1 line

why is the if statement still here.

To get a debug print? :)

Quoted 22 lines

Nick

Quoted 20 lines

Review

Quoted 6 lines
---
 drivers/net/wireless/iwlwifi/dvm/mac80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/wireless/iwlwifi/dvm/mac80211.c

drivers/net/wireless/iwlwifi/dvm/mac80211.c static bool iwl_resume_status_fn(struct

Quoted 4 lines

index 5abd62e..21e808c 100644

drivers/net/wireless/iwlwifi/dvm/mac80211.c +0 -0
@@ -409,7 +409,7 @@ static bool iwl_resume_status_fn(struct

iwl_notif_wait_data *notif_wait,

Quoted 8 lines
drivers/net/wireless/iwlwifi/dvm/mac80211.c +1 -1
 	if (iwl_rx_packet_payload_len(pkt) != sizeof(*resume_data->cmd)) {
 		IWL_ERR(priv, "rx wrong size data\n");
-		return true;
+		return false;
 	}
 	memcpy(resume_data->cmd, pkt->data, sizeof(*resume_data->cmd));
 	resume_data->valid = true;