Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/linville/wireless into for-davem
  • Loading branch information
linvjw committed Jun 18, 2012
2 parents 31fdc55 + bcb7ad7 commit 8cfe523
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 28 deletions.
27 changes: 9 additions & 18 deletions drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,15 @@ void ath_hw_pll_work(struct work_struct *work)
hw_pll_work.work);
u32 pll_sqsum;

/*
* ensure that the PLL WAR is executed only
* after the STA is associated (or) if the
* beaconing had started in interfaces that
* uses beacons.
*/
if (!(sc->sc_flags & SC_OP_BEACONS))
return;

if (AR_SREV_9485(sc->sc_ah)) {

ath9k_ps_wakeup(sc);
Expand Down Expand Up @@ -1443,15 +1452,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
}
}

if ((ah->opmode == NL80211_IFTYPE_ADHOC) ||
((vif->type == NL80211_IFTYPE_ADHOC) &&
sc->nvifs > 0)) {
ath_err(common, "Cannot create ADHOC interface when other"
" interfaces already exist.\n");
ret = -EINVAL;
goto out;
}

ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);

sc->nvifs++;
Expand All @@ -1476,15 +1476,6 @@ static int ath9k_change_interface(struct ieee80211_hw *hw,
mutex_lock(&sc->mutex);
ath9k_ps_wakeup(sc);

/* See if new interface type is valid. */
if ((new_type == NL80211_IFTYPE_ADHOC) &&
(sc->nvifs > 1)) {
ath_err(common, "When using ADHOC, it must be the only"
" interface.\n");
ret = -EINVAL;
goto out;
}

if (ath9k_uses_beacons(new_type) &&
!ath9k_uses_beacons(vif->type)) {
if (sc->nbcnvifs >= ATH_BCBUF) {
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/wireless/mwifiex/uap_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv,
struct cfg80211_ap_settings *params) {
int i;

if (!params->privacy) {
bss_config->protocol = PROTOCOL_NO_SECURITY;
bss_config->key_mgmt = KEY_MGMT_NONE;
bss_config->wpa_cfg.length = 0;
priv->sec_info.wep_enabled = 0;
priv->sec_info.wpa_enabled = 0;
priv->sec_info.wpa2_enabled = 0;

return 0;
}

switch (params->auth_type) {
case NL80211_AUTHTYPE_OPEN_SYSTEM:
bss_config->auth_mode = WLAN_AUTH_OPEN;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/rndis_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ static int rndis_check_bssid_list(struct usbnet *usbdev, u8 *match_bssid,
while (check_bssid_list_item(bssid, bssid_len, buf, len)) {
if (rndis_bss_info_update(usbdev, bssid) && match_bssid &&
matched) {
if (!ether_addr_equal(bssid->mac, match_bssid))
if (ether_addr_equal(bssid->mac, match_bssid))
*matched = true;
}

Expand Down
6 changes: 6 additions & 0 deletions include/net/bluetooth/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,12 @@ struct extended_inquiry_info {
__u8 data[240];
} __packed;

#define HCI_EV_KEY_REFRESH_COMPLETE 0x30
struct hci_ev_key_refresh_complete {
__u8 status;
__le16 handle;
} __packed;

#define HCI_EV_IO_CAPA_REQUEST 0x31
struct hci_ev_io_capa_request {
bdaddr_t bdaddr;
Expand Down
6 changes: 6 additions & 0 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,11 @@ enum ieee80211_rate_control_changed {
* to also unregister the device. If it returns 1, then mac80211
* will also go through the regular complete restart on resume.
*
* @set_wakeup: Enable or disable wakeup when WoWLAN configuration is
* modified. The reason is that device_set_wakeup_enable() is
* supposed to be called when the configuration changes, not only
* in suspend().
*
* @add_interface: Called when a netdevice attached to the hardware is
* enabled. Because it is not called for monitor mode devices, @start
* and @stop must be implemented.
Expand Down Expand Up @@ -2966,6 +2971,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
* ieee80211_generic_frame_duration - Calculate the duration field for a frame
* @hw: pointer obtained from ieee80211_alloc_hw().
* @vif: &struct ieee80211_vif pointer from the add_interface callback.
* @band: the band to calculate the frame duration on
* @frame_len: the length of the frame.
* @rate: the rate at which the frame is going to be transmitted.
*
Expand Down
48 changes: 48 additions & 0 deletions net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -3043,6 +3043,50 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
hci_dev_unlock(hdev);
}

static void hci_key_refresh_complete_evt(struct hci_dev *hdev,
struct sk_buff *skb)
{
struct hci_ev_key_refresh_complete *ev = (void *) skb->data;
struct hci_conn *conn;

BT_DBG("%s status %u handle %u", hdev->name, ev->status,
__le16_to_cpu(ev->handle));

hci_dev_lock(hdev);

conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
if (!conn)
goto unlock;

if (!ev->status)
conn->sec_level = conn->pending_sec_level;

clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);

if (ev->status && conn->state == BT_CONNECTED) {
hci_acl_disconn(conn, HCI_ERROR_AUTH_FAILURE);
hci_conn_put(conn);
goto unlock;
}

if (conn->state == BT_CONFIG) {
if (!ev->status)
conn->state = BT_CONNECTED;

hci_proto_connect_cfm(conn, ev->status);
hci_conn_put(conn);
} else {
hci_auth_cfm(conn, ev->status);

hci_conn_hold(conn);
conn->disc_timeout = HCI_DISCONN_TIMEOUT;
hci_conn_put(conn);
}

unlock:
hci_dev_unlock(hdev);
}

static inline u8 hci_get_auth_req(struct hci_conn *conn)
{
/* If remote requests dedicated bonding follow that lead */
Expand Down Expand Up @@ -3559,6 +3603,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
hci_extended_inquiry_result_evt(hdev, skb);
break;

case HCI_EV_KEY_REFRESH_COMPLETE:
hci_key_refresh_complete_evt(hdev, skb);
break;

case HCI_EV_IO_CAPA_REQUEST:
hci_io_capa_request_evt(hdev, skb);
break;
Expand Down
7 changes: 6 additions & 1 deletion net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,12 @@ static void security_timeout(struct work_struct *work)
struct l2cap_conn *conn = container_of(work, struct l2cap_conn,
security_timer.work);

l2cap_conn_del(conn->hcon, ETIMEDOUT);
BT_DBG("conn %p", conn);

if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) {
smp_chan_destroy(conn);
l2cap_conn_del(conn->hcon, ETIMEDOUT);
}
}

static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
Expand Down
18 changes: 18 additions & 0 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,22 @@ static void pairing_complete_cb(struct hci_conn *conn, u8 status)
pairing_complete(cmd, mgmt_status(status));
}

static void le_connect_complete_cb(struct hci_conn *conn, u8 status)
{
struct pending_cmd *cmd;

BT_DBG("status %u", status);

if (!status)
return;

cmd = find_pairing(conn);
if (!cmd)
BT_DBG("Unable to find a pending command");
else
pairing_complete(cmd, mgmt_status(status));
}

static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
u16 len)
{
Expand Down Expand Up @@ -1934,6 +1950,8 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
/* For LE, just connecting isn't a proof that the pairing finished */
if (cp->addr.type == BDADDR_BREDR)
conn->connect_cfm_cb = pairing_complete_cb;
else
conn->connect_cfm_cb = le_connect_complete_cb;

conn->security_cfm_cb = pairing_complete_cb;
conn->disconn_cfm_cb = pairing_complete_cb;
Expand Down
11 changes: 7 additions & 4 deletions net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)

auth |= (req->auth_req | rsp->auth_req) & SMP_AUTH_MITM;

ret = tk_request(conn, 0, auth, rsp->io_capability, req->io_capability);
ret = tk_request(conn, 0, auth, req->io_capability, rsp->io_capability);
if (ret)
return SMP_UNSPECIFIED;

Expand Down Expand Up @@ -703,7 +703,7 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
return 0;
}

static u8 smp_ltk_encrypt(struct l2cap_conn *conn)
static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
{
struct smp_ltk *key;
struct hci_conn *hcon = conn->hcon;
Expand All @@ -712,6 +712,9 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn)
if (!key)
return 0;

if (sec_level > BT_SECURITY_MEDIUM && !key->authenticated)
return 0;

if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags))
return 1;

Expand All @@ -732,7 +735,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)

hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req);

if (smp_ltk_encrypt(conn))
if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
return 0;

if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
Expand Down Expand Up @@ -771,7 +774,7 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
return 1;

if (hcon->link_mode & HCI_LM_MASTER)
if (smp_ltk_encrypt(conn))
if (smp_ltk_encrypt(conn, sec_level))
goto done;

if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
Expand Down
3 changes: 3 additions & 0 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,9 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
int i, ret;

if (!ieee80211_sdata_running(sdata))
return -ENETDOWN;

if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
ret = drv_set_bitrate_mask(local, sdata, mask);
if (ret)
Expand Down
4 changes: 2 additions & 2 deletions net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
if (WARN_ON(!ifmgd->associated))
return;

ieee80211_stop_poll(sdata);

memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);

ifmgd->associated = NULL;
Expand Down Expand Up @@ -2612,8 +2614,6 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
u8 frame_buf[DEAUTH_DISASSOC_LEN];

ieee80211_stop_poll(sdata);

ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
false, frame_buf);
mutex_unlock(&ifmgd->mtx);
Expand Down
5 changes: 5 additions & 0 deletions net/mac80211/sta_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,18 @@ struct sta_ampdu_mlme {
* @plink_timer: peer link watch timer
* @plink_timer_was_running: used by suspend/resume to restore timers
* @t_offset: timing offset relative to this host
* @t_offset_setpoint: reference timing offset of this sta to be used when
* calculating clockdrift
* @ch_type: peer's channel type
* @debugfs: debug filesystem info
* @dead: set to true when sta is unlinked
* @uploaded: set to true when sta is uploaded to the driver
* @lost_packets: number of consecutive lost packets
* @sta: station information we share with the driver
* @sta_state: duplicates information about station state (for debug)
* @beacon_loss_count: number of times beacon loss has triggered
* @supports_40mhz: tracks whether the station advertised 40 MHz support
* as we overwrite its HT parameters with the currently used value
*/
struct sta_info {
/* General information, mostly static */
Expand Down
2 changes: 1 addition & 1 deletion net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ static void reg_set_request_processed(void)
spin_unlock(&reg_requests_lock);

if (last_request->initiator == NL80211_REGDOM_SET_BY_USER)
cancel_delayed_work_sync(&reg_timeout);
cancel_delayed_work(&reg_timeout);

if (need_more_processing)
schedule_work(&reg_work);
Expand Down
2 changes: 1 addition & 1 deletion net/wireless/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
ntype == NL80211_IFTYPE_P2P_CLIENT))
return -EBUSY;

if (ntype != otype) {
if (ntype != otype && netif_running(dev)) {
err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr,
ntype);
if (err)
Expand Down

0 comments on commit 8cfe523

Please sign in to comment.