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>
This commit is contained in:
Johannes Berg 2013-04-29 12:09:14 +02:00
parent c07fe5ae06
commit a92eecbbea

View file

@ -2441,6 +2441,7 @@ TRACE_EVENT(cfg80211_report_wowlan_wakeup,
TP_STRUCT__entry(
WIPHY_ENTRY
WDEV_ENTRY
__field(bool, non_wireless)
__field(bool, disconnect)
__field(bool, magic_pkt)
__field(bool, gtk_rekey_failure)
@ -2449,20 +2450,22 @@ TRACE_EVENT(cfg80211_report_wowlan_wakeup,
__field(bool, rfkill_release)
__field(s32, pattern_idx)
__field(u32, packet_len)
__dynamic_array(u8, packet, wakeup->packet_present_len)
__dynamic_array(u8, packet,
wakeup ? wakeup->packet_present_len : 0)
),
TP_fast_assign(
WIPHY_ASSIGN;
WDEV_ASSIGN;
__entry->disconnect = wakeup->disconnect;
__entry->magic_pkt = wakeup->magic_pkt;
__entry->gtk_rekey_failure = wakeup->gtk_rekey_failure;
__entry->eap_identity_req = wakeup->eap_identity_req;
__entry->four_way_handshake = wakeup->four_way_handshake;
__entry->rfkill_release = wakeup->rfkill_release;
__entry->pattern_idx = wakeup->pattern_idx;
__entry->packet_len = wakeup->packet_len;
if (wakeup->packet && wakeup->packet_present_len)
__entry->non_wireless = !wakeup;
__entry->disconnect = wakeup ? wakeup->disconnect : false;
__entry->magic_pkt = wakeup ? wakeup->magic_pkt : false;
__entry->gtk_rekey_failure = wakeup ? wakeup->gtk_rekey_failure : false;
__entry->eap_identity_req = wakeup ? wakeup->eap_identity_req : false;
__entry->four_way_handshake = wakeup ? wakeup->four_way_handshake : false;
__entry->rfkill_release = wakeup ? wakeup->rfkill_release : false;
__entry->pattern_idx = wakeup ? wakeup->pattern_idx : false;
__entry->packet_len = wakeup ? wakeup->packet_len : false;
if (wakeup && wakeup->packet && wakeup->packet_present_len)
memcpy(__get_dynamic_array(packet), wakeup->packet,
wakeup->packet_present_len);
),