Skip to contentSkip to conversation

mwifiex: memory corruption in mwifiex_tdls_add_vht_capab()

PATCH In review Dan Carpenter 2 participants 2 messages Feb 14, 2014 – Feb 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mwifiex: memory corruption in mwifiex_tdls_add_vht_capab()

There is a typo here because the names are confusingly similar. The intent was sizeof(struct ieee80211_vht_cap) (size 12) but sizeof(struct ieee80211_ht_cap) (size 32) was used.

Anway, it's cleaner to just specify the variable instead of the type.

Fixes 5f6d5983394f ('mwifiex: add VHT support for TDLS')
drivers/net/wireless/mwifiex/tdls.c +1 -1
index 5efd456af571..9d6849f60603 100644
@@ -180,7 +180,7 @@ static int mwifiex_tdls_add_vht_capab(struct mwifiex_private *priv,
 	memset(&vht_cap, 0, sizeof(struct ieee80211_vht_cap));
 
 	mwifiex_fill_vht_cap_tlv(priv, &vht_cap, priv->curr_bss_params.band);
-	memcpy(pos, &vht_cap, sizeof(struct ieee80211_ht_cap));
+	memcpy(pos, &vht_cap, sizeof(vht_cap));
 
 	return 0;
 }
Acked-by on v1 1/1
#1 lore raw

Hi Dan,

Thanks for the patch.

Quoted 8 lines

There is a typo here because the names are confusingly similar. The intent was sizeof(struct ieee80211_vht_cap) (size 12) but sizeof(struct ieee80211_ht_cap) (size 32) was used.

Anway, it's cleaner to just specify the variable instead of the type.

Fixes 5f6d5983394f ('mwifiex: add VHT support for TDLS')

Thanks,
Bing

Quoted 14 lines
drivers/net/wireless/mwifiex/tdls.c +1 -1
index 5efd456af571..9d6849f60603 100644
@@ -180,7 +180,7 @@ static int mwifiex_tdls_add_vht_capab(struct mwifiex_private *priv,
 	memset(&vht_cap, 0, sizeof(struct ieee80211_vht_cap));
 
 	mwifiex_fill_vht_cap_tlv(priv, &vht_cap, priv->curr_bss_params.band);
-	memcpy(pos, &vht_cap, sizeof(struct ieee80211_ht_cap));
+	memcpy(pos, &vht_cap, sizeof(vht_cap));
 
 	return 0;
 }