nl80211: Verify radar event attributes exist before using them

While these attributes may be expected to be present always, this needs
to be verified within driver_nl80211.c since we cannot depend on the
kernel/driver working correctly.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-11-02 20:39:57 +02:00
parent b5476d940e
commit 884f1a3c65

View file

@ -2564,9 +2564,12 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
}
/* Get VHT params */
data.dfs_event.chan_width =
convert2width(nla_get_u32(tb[NL80211_ATTR_CHANNEL_WIDTH]));
data.dfs_event.cf1 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
if (tb[NL80211_ATTR_CHANNEL_WIDTH])
data.dfs_event.chan_width =
convert2width(nla_get_u32(
tb[NL80211_ATTR_CHANNEL_WIDTH]));
if (tb[NL80211_ATTR_CENTER_FREQ1])
data.dfs_event.cf1 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ1]);
if (tb[NL80211_ATTR_CENTER_FREQ2])
data.dfs_event.cf2 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]);