2012-10-26 16:55:09

by Antonio Quartulli

[permalink] [raw]
Subject: [PATCH mac80211] mac80211: fix SSID copy on IBSS JOIN

The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and therefore the
length is likely to be less than IEEE80211_MAX_SSID_LEN most of the times.

This patch fixes the ssid copy in ieee80211_ibss_join() by preventing it from
reading beyond the string.

Signed-off-by: Antonio Quartulli <[email protected]>
---
net/mac80211/ibss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 5f3620f..bf87c70 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1108,7 +1108,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
sdata->u.ibss.ibss_join_req = jiffies;

- memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN);
+ memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len);
sdata->u.ibss.ssid_len = params->ssid_len;

mutex_unlock(&sdata->u.ibss.mtx);
--
1.7.12.4



2012-10-26 20:51:29

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH mac80211] mac80211: fix SSID copy on IBSS JOIN

On Fri, 2012-10-26 at 18:54 +0200, Antonio Quartulli wrote:
> The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and therefore the
> length is likely to be less than IEEE80211_MAX_SSID_LEN most of the times.
>
> This patch fixes the ssid copy in ieee80211_ibss_join() by preventing it from
> reading beyond the string.
>
> Signed-off-by: Antonio Quartulli <[email protected]>

Applied, I also added Cc stable since this goes back a long time.

johannes