Skip to content

Commit

Permalink
Merge tag 'mac80211-for-net-2021-03-17' of git://git.kernel.org/pub/s…
Browse files Browse the repository at this point in the history
…cm/linux/kernel/git/jberg/mac80211

Johannes Berg says:

====================
First round of fixes for 5.12-rc:
 * HE (802.11ax) elements can be extended, handle that
 * fix locking in network namespace changes that was
   broken due to the RTNL-redux work
 * various other small fixes
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Mar 17, 2021
2 parents afa536d + 239729a commit 0692c33
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 15 deletions.
5 changes: 3 additions & 2 deletions net/mac80211/aead_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len,
struct aead_request *aead_req;
int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
u8 *__aad;
int ret;

aead_req = kzalloc(reqsize + aad_len, GFP_ATOMIC);
if (!aead_req)
Expand All @@ -40,10 +41,10 @@ int aead_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len,
aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
aead_request_set_ad(aead_req, sg[0].length);

crypto_aead_encrypt(aead_req);
ret = crypto_aead_encrypt(aead_req);
kfree_sensitive(aead_req);

return 0;
return ret;
}

int aead_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, size_t aad_len,
Expand Down
5 changes: 3 additions & 2 deletions net/mac80211/aes_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
struct aead_request *aead_req;
int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
const __le16 *fc;
int ret;

if (data_len < GMAC_MIC_LEN)
return -EINVAL;
Expand Down Expand Up @@ -59,10 +60,10 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
aead_request_set_crypt(aead_req, sg, sg, 0, iv);
aead_request_set_ad(aead_req, GMAC_AAD_LEN + data_len);

crypto_aead_encrypt(aead_req);
ret = crypto_aead_encrypt(aead_req);
kfree_sensitive(aead_req);

return 0;
return ret;
}

struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
Expand Down
4 changes: 2 additions & 2 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2950,14 +2950,14 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
continue;

for (j = 0; j < IEEE80211_HT_MCS_MASK_LEN; j++) {
if (~sdata->rc_rateidx_mcs_mask[i][j]) {
if (sdata->rc_rateidx_mcs_mask[i][j] != 0xff) {
sdata->rc_has_mcs_mask[i] = true;
break;
}
}

for (j = 0; j < NL80211_VHT_NSS_MAX; j++) {
if (~sdata->rc_rateidx_vht_mcs_mask[i][j]) {
if (sdata->rc_rateidx_vht_mcs_mask[i][j] != 0xffff) {
sdata->rc_has_vht_mcs_mask[i] = true;
break;
}
Expand Down
2 changes: 2 additions & 0 deletions net/mac80211/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,8 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)

/* remove beacon */
kfree(sdata->u.ibss.ie);
sdata->u.ibss.ie = NULL;
sdata->u.ibss.ie_len = 0;

/* on the next join, re-program HT parameters */
memset(&ifibss->ht_capa, 0, sizeof(ifibss->ht_capa));
Expand Down
13 changes: 12 additions & 1 deletion net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
continue;

if (!dflt_chandef.chan) {
/*
* Assign the first enabled channel to dflt_chandef
* from the list of channels
*/
for (i = 0; i < sband->n_channels; i++)
if (!(sband->channels[i].flags &
IEEE80211_CHAN_DISABLED))
break;
/* if none found then use the first anyway */
if (i == sband->n_channels)
i = 0;
cfg80211_chandef_create(&dflt_chandef,
&sband->channels[0],
&sband->channels[i],
NL80211_CHAN_NO_HT);
/* init channel we're on */
if (!local->use_chanctx && !local->_oper_chandef.chan) {
Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -5071,7 +5071,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
he_oper_ie = cfg80211_find_ext_ie(WLAN_EID_EXT_HE_OPERATION,
ies->data, ies->len);
if (he_oper_ie &&
he_oper_ie[1] == ieee80211_he_oper_size(&he_oper_ie[3]))
he_oper_ie[1] >= ieee80211_he_oper_size(&he_oper_ie[3]))
he_oper = (void *)(he_oper_ie + 3);
else
he_oper = NULL;
Expand Down
2 changes: 0 additions & 2 deletions net/mac80211/rc80211_minstrel_ht.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,15 +805,13 @@ minstrel_ht_group_min_rate_offset(struct minstrel_ht_sta *mi, int group,
static u16
minstrel_ht_next_inc_rate(struct minstrel_ht_sta *mi, u32 fast_rate_dur)
{
struct minstrel_mcs_group_data *mg;
u8 type = MINSTREL_SAMPLE_TYPE_INC;
int i, index = 0;
u8 group;

group = mi->sample[type].sample_group;
for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) {
group = (group + 1) % ARRAY_SIZE(minstrel_mcs_groups);
mg = &mi->groups[group];

index = minstrel_ht_group_min_rate_offset(mi, group,
fast_rate_dur);
Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ static void ieee80211_parse_extension_element(u32 *crc,
break;
case WLAN_EID_EXT_HE_OPERATION:
if (len >= sizeof(*elems->he_operation) &&
len == ieee80211_he_oper_size(data) - 1) {
len >= ieee80211_he_oper_size(data) - 1) {
if (crc)
*crc = crc32_be(*crc, (void *)elem,
elem->datalen + 2);
Expand Down
12 changes: 8 additions & 4 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ __cfg80211_wdev_from_attrs(struct cfg80211_registered_device *rdev,
struct wireless_dev *result = NULL;
bool have_ifidx = attrs[NL80211_ATTR_IFINDEX];
bool have_wdev_id = attrs[NL80211_ATTR_WDEV];
u64 wdev_id;
u64 wdev_id = 0;
int wiphy_idx = -1;
int ifidx = -1;

Expand Down Expand Up @@ -14789,6 +14789,7 @@ static int nl80211_set_tid_config(struct sk_buff *skb,
#define NL80211_FLAG_NEED_WDEV_UP (NL80211_FLAG_NEED_WDEV |\
NL80211_FLAG_CHECK_NETDEV_UP)
#define NL80211_FLAG_CLEAR_SKB 0x20
#define NL80211_FLAG_NO_WIPHY_MTX 0x40

static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
struct genl_info *info)
Expand Down Expand Up @@ -14840,7 +14841,7 @@ static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
info->user_ptr[0] = rdev;
}

if (rdev) {
if (rdev && !(ops->internal_flags & NL80211_FLAG_NO_WIPHY_MTX)) {
wiphy_lock(&rdev->wiphy);
/* we keep the mutex locked until post_doit */
__release(&rdev->wiphy.mtx);
Expand All @@ -14865,7 +14866,8 @@ static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
}
}

if (info->user_ptr[0]) {
if (info->user_ptr[0] &&
!(ops->internal_flags & NL80211_FLAG_NO_WIPHY_MTX)) {
struct cfg80211_registered_device *rdev = info->user_ptr[0];

/* we kept the mutex locked since pre_doit */
Expand Down Expand Up @@ -15329,7 +15331,9 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = nl80211_wiphy_netns,
.flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY,
.internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL |
NL80211_FLAG_NO_WIPHY_MTX,
},
{
.cmd = NL80211_CMD_GET_SURVEY,
Expand Down

0 comments on commit 0692c33

Please sign in to comment.