aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2016-07-12 07:43:18 -0400
committerKalle Valo <kvalo@codeaurora.org>2016-07-18 15:39:42 -0400
commit4028a514eaa6649693be1a7cb8d2b84a8fc8cc8c (patch)
tree88df63be3778760352563f8c4214bace28de7b55
parent83d58d53e062aad0f9dfbb68780bfaebf4e8bafe (diff)
mwifiex: fix possible memory leak in mwifiex_cfg80211_start_ap()
memory is malloced in mwifiex_cfg80211_start_ap() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/marvell/mwifiex/cfg80211.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 867ab815e16a..a8ff969c95c2 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -1936,10 +1936,9 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
1936 mwifiex_set_uap_rates(bss_cfg, params); 1936 mwifiex_set_uap_rates(bss_cfg, params);
1937 1937
1938 if (mwifiex_set_secure_params(priv, bss_cfg, params)) { 1938 if (mwifiex_set_secure_params(priv, bss_cfg, params)) {
1939 kfree(bss_cfg);
1940 mwifiex_dbg(priv->adapter, ERROR, 1939 mwifiex_dbg(priv->adapter, ERROR,
1941 "Failed to parse secuirty parameters!\n"); 1940 "Failed to parse secuirty parameters!\n");
1942 return -1; 1941 goto out;
1943 } 1942 }
1944 1943
1945 mwifiex_set_ht_params(priv, bss_cfg, params); 1944 mwifiex_set_ht_params(priv, bss_cfg, params);
@@ -1968,7 +1967,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
1968 if (mwifiex_11h_activate(priv, false)) { 1967 if (mwifiex_11h_activate(priv, false)) {
1969 mwifiex_dbg(priv->adapter, ERROR, 1968 mwifiex_dbg(priv->adapter, ERROR,
1970 "Failed to disable 11h extensions!!"); 1969 "Failed to disable 11h extensions!!");
1971 return -1; 1970 goto out;
1972 } 1971 }
1973 priv->state_11h.is_11h_active = false; 1972 priv->state_11h.is_11h_active = false;
1974 } 1973 }
@@ -1976,12 +1975,11 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
1976 if (mwifiex_config_start_uap(priv, bss_cfg)) { 1975 if (mwifiex_config_start_uap(priv, bss_cfg)) {
1977 mwifiex_dbg(priv->adapter, ERROR, 1976 mwifiex_dbg(priv->adapter, ERROR,
1978 "Failed to start AP\n"); 1977 "Failed to start AP\n");
1979 kfree(bss_cfg); 1978 goto out;
1980 return -1;
1981 } 1979 }
1982 1980
1983 if (mwifiex_set_mgmt_ies(priv, &params->beacon)) 1981 if (mwifiex_set_mgmt_ies(priv, &params->beacon))
1984 return -1; 1982 goto out;
1985 1983
1986 if (!netif_carrier_ok(priv->netdev)) 1984 if (!netif_carrier_ok(priv->netdev))
1987 netif_carrier_on(priv->netdev); 1985 netif_carrier_on(priv->netdev);
@@ -1990,6 +1988,10 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
1990 memcpy(&priv->bss_cfg, bss_cfg, sizeof(priv->bss_cfg)); 1988 memcpy(&priv->bss_cfg, bss_cfg, sizeof(priv->bss_cfg));
1991 kfree(bss_cfg); 1989 kfree(bss_cfg);
1992 return 0; 1990 return 0;
1991
1992out:
1993 kfree(bss_cfg);
1994 return -1;
1993} 1995}
1994 1996
1995/* 1997/*