[PATCH 2/2] Check protocol number in nl80211 netlink socket release notification handler.

2016-04-06 Thread Dmitry Ivanov
This patch corrects the problem where non-privileged user can create
netlink socket with the same port_id as used by hostapd but different
protocol number. Upon close() or process termination, a notification is
sent  to nl80211 subsystem which will destroy virtual wireless network
interfaces created by hostapd like it just died but in fact hostapd is
still running. This is possible because port_id is unique within particular
protocol number only.

Fixes: 026331c4d9b5 ("cfg80211/mac80211: allow registering for and sending 
action frames")
Signed-off-by: Dmitry Ivanov 
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 98c9242..056a730 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -13216,7 +13216,7 @@ static int nl80211_netlink_notify(struct notifier_block 
* nb,
struct wireless_dev *wdev;
struct cfg80211_beacon_registration *reg, *tmp;
 
-   if (state != NETLINK_URELEASE)
+   if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC)
return NOTIFY_DONE;
 
rcu_read_lock();
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Do not send netlink socket release notification when socket is not bound

2016-04-06 Thread Dmitry Ivanov
This patch corrects the problem where non-privileged user may create
netlink socket with port_id equal to port_id used by hostapd to create
virtual wireless network interfaces. Call to bind() will fail for such
socket, but release notification sent on close() or process termination
to nl80211 subsystem will destroy virtual network interfaces while
hostapd is still running.

Signed-off-by: Dmitry Ivanov 
---
 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 215fc08..330ebd6 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -688,7 +688,7 @@ static int netlink_release(struct socket *sock)
 
skb_queue_purge(&sk->sk_write_queue);
 
-   if (nlk->portid) {
+   if (nlk->portid && nlk->bound) {
struct netlink_notify n = {
.net = sock_net(sk),
.protocol = sk->sk_protocol,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Minstrel_ht: use lowest rate last

2015-10-26 Thread Dmitry Ivanov
Minstrel_ht: use lowest rate last as in minstrel.
It should improve robustness in environments with non-stationary noise.

Signed-off-by: Dmitry Ivanov 
---
 net/mac80211/rc80211_minstrel_ht.c | 8 +++-
 net/mac80211/rc80211_minstrel_ht.h | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/rc80211_minstrel_ht.c 
b/net/mac80211/rc80211_minstrel_ht.c
index 3928dbd..8abbdcc 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -906,7 +906,12 @@ minstrel_ht_update_rates(struct minstrel_priv *mp, struct 
minstrel_ht_sta *mi)
minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
}
 
-   rates->rate[i].idx = -1;
+   /* Use lowest rate last */
+   rates->rate[i].idx = mi->lowest_rix;
+   rates->rate[i].count = mp->max_retry;
+   rates->rate[i].count_cts = mp->max_retry;
+   rates->rate[i].count_rts = mp->max_retry;
+
rate_control_set_rates(mp->hw, mi->sta, rates);
 }
 
@@ -1127,6 +1132,7 @@ minstrel_ht_update_caps(void *priv, struct 
ieee80211_supported_band *sband,
memset(mi, 0, sizeof(*mi));
 
mi->sta = sta;
+   mi->lowest_rix = rate_lowest_index(sband, sta);
mi->last_stats_update = jiffies;
 
ack_dur = ieee80211_frame_duration(sband->band, 10, 60, 1, 1, 0);
diff --git a/net/mac80211/rc80211_minstrel_ht.h 
b/net/mac80211/rc80211_minstrel_ht.h
index e8b52a9..90b8e39 100644
--- a/net/mac80211/rc80211_minstrel_ht.h
+++ b/net/mac80211/rc80211_minstrel_ht.h
@@ -73,6 +73,8 @@ struct minstrel_ht_sta {
/* ampdu length (EWMA) */
unsigned int avg_ampdu_len;
 
+   unsigned int lowest_rix;
+
/* overall sorted rate set */
u16 max_tp_rate[MAX_THR_RATES];
u16 max_prob_rate;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath10k: report per-chain RSSI

2015-07-29 Thread Dmitry Ivanov
ath10k: report per-chain RSSI.

Signed-off-by: Dmitry Ivanov 
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index d7d1183..2d50939 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -832,6 +832,20 @@ static void ath10k_htt_rx_h_signal(struct ath10k *ar,
   struct ieee80211_rx_status *status,
   struct htt_rx_desc *rxd)
 {
+   {
+   /* Linux array has size IEEE80211_MAX_CHAINS, FW array has size 
4 */
+   BUILD_BUG_ON(IEEE80211_MAX_CHAINS != 4);
+   u32 i = IEEE80211_MAX_CHAINS;
+   u8 signal_per_chain;
+   do {
+   i--;
+   signal_per_chain = 
rxd->ppdu_start.rssi_chains[i].pri20_mhz;
+   if (signal_per_chain != 0x80) {
+   status->chains |= BIT(i);
+   status->chain_signal[i] = 
ATH10K_DEFAULT_NOISE_FLOOR + signal_per_chain;
+   }
+   } while (i);
+   }
/* FIXME: Get real NF */
status->signal = ATH10K_DEFAULT_NOISE_FLOOR +
 rxd->ppdu_start.rssi_comb;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html