Search Linux Wireless

Re: [patch 2/5] Add basic support for IEEE 802.11n discovery and association

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/26/07, mohamed <mabbas@xxxxxxxxxxxxxxx> wrote:

+/* Get 11n capabilties from low level driver */
+static void ieee80211_fill_ht_ie(struct net_device *dev,
+                                struct ieee80211_ht_capability *ht_capab)
+{
+       int rc;
+       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+
+       if (!local->ops->get_ht_capab){
+               memset(ht_capab, 0, sizeof(struct ieee80211_ht_capability));
+               return;
+       }
+
+       rc = local->ops->get_ht_capab(local_to_hw(local), ht_capab);
+       if (!rc) {
+               memset(ht_capab, 0, sizeof(struct ieee80211_ht_capability));
+               return;
+       }

+       ht_capab->capabilitiesInfo = (__le16) cpu_to_le16(
+                                       ht_capab->capabilitiesInfo);
+       ht_capab->extended_ht_capability_info = (__le16) cpu_to_le16(
+                                       ht_capab->extended_ht_capability_info);
+       ht_capab->tx_BF_capability_info = (__le32) cpu_to_le32(
+                                       ht_capab->tx_BF_capability_info);
+}
+

We should memset to 0 the entire ht_capab to regardless as its coming
from skb_put() otherwise we'll get random data there if we don't set
it and we sure as hell don't want to just transmit that :) Also
ieee80211_send_assoc() is already checking for
local->ops->get_ht_capab so lets just do a BUG_ON here to capture
cases where someone else didn't do the proper checking. So how about
instead something like:

/* Get 11n capabilties from low level driver */
static void ieee80211_fill_ht_ie(struct net_device *dev,
                               struct ieee80211_ht_capability *ht_capab)
{
      struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
      BUG_ON(!local->ops->get_ht_capab);
      memset(ht_capab, 0, sizeof(struct ieee80211_ht_capability));
      if (!local->ops->get_ht_capab(local_to_hw(local), ht_capab))
              return;
      ht_capab->capabilitiesInfo = (__le16) cpu_to_le16(
                                      ht_capab->capabilitiesInfo);
      ht_capab->extended_ht_capability_info = (__le16) cpu_to_le16(
                                      ht_capab->extended_ht_capability_info);
      ht_capab->tx_BF_capability_info = (__le32) cpu_to_le32(
                                      ht_capab->tx_BF_capability_info);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux