提交 80e78ef7 编写于 作者: D Dan Williams 提交者: John W. Linville

[PATCH] libertas: fix deadlock SIOCGIWSCAN handler

Update signal quality before the locked scan result translation loop,
because calling libertas_prepare_and_send_command() with the
'waitforrsp' option grabs adapter->lock in the command return processing,
leading to the deadlock.
Signed-off-by: NDan Williams <dcbw@redhat.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 94b23855
...@@ -1506,7 +1506,6 @@ static inline char *libertas_translate_scan(wlan_private *priv, ...@@ -1506,7 +1506,6 @@ static inline char *libertas_translate_scan(wlan_private *priv,
char *current_val; /* For rates */ char *current_val; /* For rates */
struct iw_event iwe; /* Temporary buffer */ struct iw_event iwe; /* Temporary buffer */
int j; int j;
int ret;
#define PERFECT_RSSI ((u8)50) #define PERFECT_RSSI ((u8)50)
#define WORST_RSSI ((u8)0) #define WORST_RSSI ((u8)0)
#define RSSI_DIFF ((u8)(PERFECT_RSSI - WORST_RSSI)) #define RSSI_DIFF ((u8)(PERFECT_RSSI - WORST_RSSI))
...@@ -1560,22 +1559,18 @@ static inline char *libertas_translate_scan(wlan_private *priv, ...@@ -1560,22 +1559,18 @@ static inline char *libertas_translate_scan(wlan_private *priv,
iwe.u.qual.noise = iwe.u.qual.noise =
CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
} }
if ((adapter->mode == IW_MODE_AUTO) &&
!libertas_SSID_cmp(&adapter->curbssparams.ssid, &bss->ssid) /* Locally created ad-hoc BSSs won't have beacons if this is the
&& adapter->adhoccreate) { * only station in the adhoc network; so get signal strength
ret = libertas_prepare_and_send_command(priv, * from receive statistics.
cmd_802_11_rssi, */
0, if ((adapter->mode == IW_MODE_ADHOC)
cmd_option_waitforrsp, && adapter->adhoccreate
0, NULL); && !libertas_SSID_cmp(&adapter->curbssparams.ssid, &bss->ssid)) {
int snr, nf;
if (!ret) { snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
iwe.u.qual.level = nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / iwe.u.qual.level = CAL_RSSI(snr, nf);
AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] /
AVG_SCALE);
}
} }
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN);
...@@ -1665,6 +1660,12 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info, ...@@ -1665,6 +1660,12 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
if (!adapter->nr_cmd_pending && adapter->last_scanned_channel) if (!adapter->nr_cmd_pending && adapter->last_scanned_channel)
wlan_scan_networks(priv, NULL, 0); wlan_scan_networks(priv, NULL, 0);
/* Update RSSI if current BSS is a locally created ad-hoc BSS */
if ((adapter->inframode == wlan802_11ibss) && adapter->adhoccreate) {
libertas_prepare_and_send_command(priv, cmd_802_11_rssi, 0,
cmd_option_waitforrsp, 0, NULL);
}
mutex_lock(&adapter->lock); mutex_lock(&adapter->lock);
list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) { list_for_each_entry_safe (iter_bss, safe, &adapter->network_list, list) {
char * next_ev; char * next_ev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册