wifi: fix some bugs in nl80211 code

A forgotten return caused a free of invalid data on success, and
the txrate should be in Kbps.
This commit is contained in:
Dan Williams
2011-10-05 10:30:04 -05:00
parent bd66cda773
commit d043e28b44

View File

@@ -87,6 +87,7 @@ static struct nl_msg *nl80211_alloc_msg (WifiDataNl80211 *nl80211,
NLA_PUT_U32 (msg, NL80211_ATTR_IFINDEX, nl80211->parent.ifindex); NLA_PUT_U32 (msg, NL80211_ATTR_IFINDEX, nl80211->parent.ifindex);
return msg; return msg;
nla_put_failure: nla_put_failure:
nlmsg_free (msg); nlmsg_free (msg);
return NULL; return NULL;
@@ -476,6 +477,8 @@ static void nl80211_get_ap_info (WifiDataNl80211 *nl80211,
sta_info); sta_info);
} }
return;
nla_put_failure: nla_put_failure:
nlmsg_free (msg); nlmsg_free (msg);
return; return;
@@ -489,7 +492,7 @@ wifi_nl80211_get_rate (WifiData *data)
nl80211_get_ap_info (nl80211, &sta_info); nl80211_get_ap_info (nl80211, &sta_info);
return sta_info.txrate; return sta_info.txrate * 1000;
} }
static int static int
@@ -687,6 +690,10 @@ wifi_nl80211_init (const char *iface, int ifindex)
nl80211->parent.can_scan_ssid = device_info.can_scan_ssid; nl80211->parent.can_scan_ssid = device_info.can_scan_ssid;
nl80211->parent.caps = device_info.caps; nl80211->parent.caps = device_info.caps;
nm_log_info (LOGD_HW | LOGD_WIFI,
"(%s): using nl80211 for WiFi device control",
nl80211->parent.iface);
return (WifiData *) nl80211; return (WifiData *) nl80211;
error: error: