diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-04-29 06:09:14 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-05-16 16:38:03 -0400 |
commit | a92eecbbeaf01ea2267751569dd3301248513915 (patch) | |
tree | 3d351cba7e063f9e2fa1cf211df4f6cf9b886fb3 /net/wireless/trace.h | |
parent | c07fe5ae0667f1077d671f62a093261223f918af (diff) |
cfg80211: fix WoWLAN wakeup tracing
If the device reports a non-wireless wakeup reason, the
tracing code crashes trying to dereference a NULL pointer.
Fix this by checking the pointer on all accesses and also
add a non_wireless tag to the event.
Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/trace.h')
-rw-r--r-- | net/wireless/trace.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index ecd4fcec3c94..5755bc14abbd 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -2441,6 +2441,7 @@ TRACE_EVENT(cfg80211_report_wowlan_wakeup, | |||
2441 | TP_STRUCT__entry( | 2441 | TP_STRUCT__entry( |
2442 | WIPHY_ENTRY | 2442 | WIPHY_ENTRY |
2443 | WDEV_ENTRY | 2443 | WDEV_ENTRY |
2444 | __field(bool, non_wireless) | ||
2444 | __field(bool, disconnect) | 2445 | __field(bool, disconnect) |
2445 | __field(bool, magic_pkt) | 2446 | __field(bool, magic_pkt) |
2446 | __field(bool, gtk_rekey_failure) | 2447 | __field(bool, gtk_rekey_failure) |
@@ -2449,20 +2450,22 @@ TRACE_EVENT(cfg80211_report_wowlan_wakeup, | |||
2449 | __field(bool, rfkill_release) | 2450 | __field(bool, rfkill_release) |
2450 | __field(s32, pattern_idx) | 2451 | __field(s32, pattern_idx) |
2451 | __field(u32, packet_len) | 2452 | __field(u32, packet_len) |
2452 | __dynamic_array(u8, packet, wakeup->packet_present_len) | 2453 | __dynamic_array(u8, packet, |
2454 | wakeup ? wakeup->packet_present_len : 0) | ||
2453 | ), | 2455 | ), |
2454 | TP_fast_assign( | 2456 | TP_fast_assign( |
2455 | WIPHY_ASSIGN; | 2457 | WIPHY_ASSIGN; |
2456 | WDEV_ASSIGN; | 2458 | WDEV_ASSIGN; |
2457 | __entry->disconnect = wakeup->disconnect; | 2459 | __entry->non_wireless = !wakeup; |
2458 | __entry->magic_pkt = wakeup->magic_pkt; | 2460 | __entry->disconnect = wakeup ? wakeup->disconnect : false; |
2459 | __entry->gtk_rekey_failure = wakeup->gtk_rekey_failure; | 2461 | __entry->magic_pkt = wakeup ? wakeup->magic_pkt : false; |
2460 | __entry->eap_identity_req = wakeup->eap_identity_req; | 2462 | __entry->gtk_rekey_failure = wakeup ? wakeup->gtk_rekey_failure : false; |
2461 | __entry->four_way_handshake = wakeup->four_way_handshake; | 2463 | __entry->eap_identity_req = wakeup ? wakeup->eap_identity_req : false; |
2462 | __entry->rfkill_release = wakeup->rfkill_release; | 2464 | __entry->four_way_handshake = wakeup ? wakeup->four_way_handshake : false; |
2463 | __entry->pattern_idx = wakeup->pattern_idx; | 2465 | __entry->rfkill_release = wakeup ? wakeup->rfkill_release : false; |
2464 | __entry->packet_len = wakeup->packet_len; | 2466 | __entry->pattern_idx = wakeup ? wakeup->pattern_idx : false; |
2465 | if (wakeup->packet && wakeup->packet_present_len) | 2467 | __entry->packet_len = wakeup ? wakeup->packet_len : false; |
2468 | if (wakeup && wakeup->packet && wakeup->packet_present_len) | ||
2466 | memcpy(__get_dynamic_array(packet), wakeup->packet, | 2469 | memcpy(__get_dynamic_array(packet), wakeup->packet, |
2467 | wakeup->packet_present_len); | 2470 | wakeup->packet_present_len); |
2468 | ), | 2471 | ), |