Commit 25ac3417 authored by David S. Miller's avatar David S. Miller

Merge tag 'mac80211-for-davem-2016-02-23' of...

Merge tag 'mac80211-for-davem-2016-02-23' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211

Johannes Berg says:

====================
Another small set of fixes:
 * stop critical protocol session on disconnect to avoid
   it getting stuck
 * wext: fix two RTNL message ordering issues
 * fix an uninitialized value (found by KASAN)
 * fix an out-of-bounds access (also found by KASAN)
 * clear connection keys when freeing them in all cases
   (IBSS, all other places already did so)
 * fix expected throughput unit to get consistent values
 * set default TX aggregation timeout to 0 in minstrel
   to avoid (really just hide) issues and perform better
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2da897e5 b8607152
...@@ -439,6 +439,12 @@ int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length); ...@@ -439,6 +439,12 @@ int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length);
/* Send a single event to user space */ /* Send a single event to user space */
void wireless_send_event(struct net_device *dev, unsigned int cmd, void wireless_send_event(struct net_device *dev, unsigned int cmd,
union iwreq_data *wrqu, const char *extra); union iwreq_data *wrqu, const char *extra);
#ifdef CONFIG_WEXT_CORE
/* flush all previous wext events - if work is done from netdev notifiers */
void wireless_nlevent_flush(void);
#else
static inline void wireless_nlevent_flush(void) {}
#endif
/* We may need a function to send a stream of events to user space. /* We may need a function to send a stream of events to user space.
* More on that later... */ * More on that later... */
......
...@@ -291,7 +291,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, ...@@ -291,7 +291,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
} }
/* prepare A-MPDU MLME for Rx aggregation */ /* prepare A-MPDU MLME for Rx aggregation */
tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL); tid_agg_rx = kzalloc(sizeof(*tid_agg_rx), GFP_KERNEL);
if (!tid_agg_rx) if (!tid_agg_rx)
goto end; goto end;
......
...@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_throughput(void *priv_sta) ...@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_throughput(void *priv_sta)
* computing cur_tp * computing cur_tp
*/ */
tmp_mrs = &mi->r[idx].stats; tmp_mrs = &mi->r[idx].stats;
tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma); tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024; tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
return tmp_cur_tp; return tmp_cur_tp;
......
...@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct minstrel_ht_sta *mi, u16 index) ...@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct minstrel_ht_sta *mi, u16 index)
(max_tp_group != MINSTREL_CCK_GROUP)) (max_tp_group != MINSTREL_CCK_GROUP))
return; return;
max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) { if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx, cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
mrs->prob_ewma); mrs->prob_ewma);
if (cur_tp_avg > tmp_tp_avg) if (cur_tp_avg > tmp_tp_avg)
mi->max_prob_rate = index; mi->max_prob_rate = index;
max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group, max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
max_gpr_idx, max_gpr_idx,
max_gpr_prob); max_gpr_prob);
...@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct minstrel_ht_sta *mi, u16 index) ...@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct minstrel_ht_sta *mi, u16 index)
} else { } else {
if (mrs->prob_ewma > tmp_prob) if (mrs->prob_ewma > tmp_prob)
mi->max_prob_rate = index; mi->max_prob_rate = index;
if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma) if (mrs->prob_ewma > max_gpr_prob)
mg->max_group_prob_rate = index; mg->max_group_prob_rate = index;
} }
} }
...@@ -691,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb) ...@@ -691,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb)
if (likely(sta->ampdu_mlme.tid_tx[tid])) if (likely(sta->ampdu_mlme.tid_tx[tid]))
return; return;
ieee80211_start_tx_ba_session(pubsta, tid, 5000); ieee80211_start_tx_ba_session(pubsta, tid, 0);
} }
static void static void
...@@ -1334,7 +1335,8 @@ static u32 minstrel_ht_get_expected_throughput(void *priv_sta) ...@@ -1334,7 +1335,8 @@ static u32 minstrel_ht_get_expected_throughput(void *priv_sta)
prob = mi->groups[i].rates[j].prob_ewma; prob = mi->groups[i].rates[j].prob_ewma;
/* convert tp_avg from pkt per second in kbps */ /* convert tp_avg from pkt per second in kbps */
tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024; tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
return tp_avg; return tp_avg;
} }
......
...@@ -1147,6 +1147,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, ...@@ -1147,6 +1147,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
return NOTIFY_DONE; return NOTIFY_DONE;
} }
wireless_nlevent_flush();
return NOTIFY_OK; return NOTIFY_OK;
} }
......
...@@ -7547,7 +7547,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) ...@@ -7547,7 +7547,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
if ((ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT) && if ((ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT) &&
no_ht) { no_ht) {
kfree(connkeys); kzfree(connkeys);
return -EINVAL; return -EINVAL;
} }
} }
......
...@@ -917,6 +917,12 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, ...@@ -917,6 +917,12 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
nl80211_send_disconnected(rdev, dev, reason, ie, ie_len, from_ap); nl80211_send_disconnected(rdev, dev, reason, ie, ie_len, from_ap);
/* stop critical protocol if supported */
if (rdev->ops->crit_proto_stop && rdev->crit_proto_nlportid) {
rdev->crit_proto_nlportid = 0;
rdev_crit_proto_stop(rdev, wdev);
}
/* /*
* Delete all the keys ... pairwise keys can't really * Delete all the keys ... pairwise keys can't really
* exist any more anyway, but default keys might. * exist any more anyway, but default keys might.
......
...@@ -342,6 +342,40 @@ static const int compat_event_type_size[] = { ...@@ -342,6 +342,40 @@ static const int compat_event_type_size[] = {
/* IW event code */ /* IW event code */
void wireless_nlevent_flush(void)
{
struct sk_buff *skb;
struct net *net;
ASSERT_RTNL();
for_each_net(net) {
while ((skb = skb_dequeue(&net->wext_nlevents)))
rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
GFP_KERNEL);
}
}
EXPORT_SYMBOL_GPL(wireless_nlevent_flush);
static int wext_netdev_notifier_call(struct notifier_block *nb,
unsigned long state, void *ptr)
{
/*
* When a netdev changes state in any way, flush all pending messages
* to avoid them going out in a strange order, e.g. RTM_NEWLINK after
* RTM_DELLINK, or with IFF_UP after without IFF_UP during dev_close()
* or similar - all of which could otherwise happen due to delays from
* schedule_work().
*/
wireless_nlevent_flush();
return NOTIFY_OK;
}
static struct notifier_block wext_netdev_notifier = {
.notifier_call = wext_netdev_notifier_call,
};
static int __net_init wext_pernet_init(struct net *net) static int __net_init wext_pernet_init(struct net *net)
{ {
skb_queue_head_init(&net->wext_nlevents); skb_queue_head_init(&net->wext_nlevents);
...@@ -360,7 +394,12 @@ static struct pernet_operations wext_pernet_ops = { ...@@ -360,7 +394,12 @@ static struct pernet_operations wext_pernet_ops = {
static int __init wireless_nlevent_init(void) static int __init wireless_nlevent_init(void)
{ {
return register_pernet_subsys(&wext_pernet_ops); int err = register_pernet_subsys(&wext_pernet_ops);
if (err)
return err;
return register_netdevice_notifier(&wext_netdev_notifier);
} }
subsys_initcall(wireless_nlevent_init); subsys_initcall(wireless_nlevent_init);
...@@ -368,17 +407,8 @@ subsys_initcall(wireless_nlevent_init); ...@@ -368,17 +407,8 @@ subsys_initcall(wireless_nlevent_init);
/* Process events generated by the wireless layer or the driver. */ /* Process events generated by the wireless layer or the driver. */
static void wireless_nlevent_process(struct work_struct *work) static void wireless_nlevent_process(struct work_struct *work)
{ {
struct sk_buff *skb;
struct net *net;
rtnl_lock(); rtnl_lock();
wireless_nlevent_flush();
for_each_net(net) {
while ((skb = skb_dequeue(&net->wext_nlevents)))
rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL,
GFP_KERNEL);
}
rtnl_unlock(); rtnl_unlock();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment