[PATCH net-next] mac80211: fix missing unlock on error in ieee80211_mark_sta_auth()

2018-10-15 Thread Wei Yongjun
Add the missing unlock before return from function
ieee80211_mark_sta_auth() in the error handling case.

Fixes: fc107a933071 ("mac80211: Helper function for marking STA authenticated")
Signed-off-by: Wei Yongjun 
---
 net/mac80211/mlme.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index d2bc8d5..755ca4d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2778,10 +2778,12 @@ static bool ieee80211_mark_sta_auth(struct 
ieee80211_sub_if_data *sdata,
sta = sta_info_get(sdata, bssid);
if (!sta) {
WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid);
+   mutex_unlock(>local->sta_mtx);
return false;
}
if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
sdata_info(sdata, "failed moving %pM to auth\n", bssid);
+   mutex_unlock(>local->sta_mtx);
return false;
}
mutex_unlock(>local->sta_mtx);



[PATCH net-next] ath10k: fix copy-paste error in ath10k_qmi_setup_msa_resources()

2018-10-15 Thread Wei Yongjun
The return value from devm_memremap() is not checked correctly.
The test is done against a wrong variable. This patch fix it.

Fixes: ba94c753ccb4 ("ath10k: add QMI message handshake for wcn3990 client")
Signed-off-by: Wei Yongjun 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 56cb183..c2cbb41 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -931,7 +931,7 @@ static int ath10k_qmi_setup_msa_resources(struct ath10k_qmi 
*qmi, u32 msa_size)
qmi->msa_mem_size = resource_size();
qmi->msa_va = devm_memremap(dev, qmi->msa_pa, qmi->msa_mem_size,
MEMREMAP_WT);
-   if (!qmi->msa_pa) {
+   if (!qmi->msa_va) {
dev_err(dev, "failed to map memory region: %pa\n", 
);
return -EBUSY;
}



[PATCH net-next] mac80211: fix error handling in ieee80211_register_hw()

2018-09-26 Thread Wei Yongjun
Fix to return a negative error code -ENOMEM from the kmemdup
error handling case instead of 0.

Fixes: 09b4a4faf9d0 ("mac80211: introduce capability flags for VHT EXT NSS 
support")
Signed-off-by: Wei Yongjun 
---
 net/mac80211/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 7738101..e6375d0 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1203,8 +1203,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
continue;
 
sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL);
-   if (!sband)
+   if (!sband) {
+   result = -ENOMEM;
goto fail_rate;
+   }
 
wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT 
NSS BW flag\n",
  band);



[PATCH net-next] cfg80211: fix possible memory leak in regdb_query_country()

2018-03-29 Thread Wei Yongjun
'wmm_ptrs' is malloced in regdb_query_country() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 net/wireless/reg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 16c7e4e..ac3e12c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1026,6 +1026,7 @@ static int regdb_query_country(const struct fwdb_header 
*db,
 
if (!tmp_rd) {
kfree(regdom);
+   kfree(wmm_ptrs);
return -ENOMEM;
}
regdom = tmp_rd;





[PATCH net-next] mac80211_hwsim: fix possible memory leak in hwsim_new_radio_nl()

2018-01-17 Thread Wei Yongjun
'hwname' is malloced in hwsim_new_radio_nl() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: ff4dd73dd2b4 ("mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/net/wireless/mac80211_hwsim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index e542555..34052c1 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3155,8 +3155,10 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, 
struct genl_info *info)
if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
 
-   if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
+   if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom)) {
+   kfree(hwname);
return -EINVAL;
+   }
param.regd = hwsim_world_regdom_custom[idx];
}



[PATCH net-next] rsi: remove unused including

2017-10-27 Thread Wei Yongjun
Remove including  that don't need it.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/net/wireless/rsi/rsi_91x_ps.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_ps.c 
b/drivers/net/wireless/rsi/rsi_91x_ps.c
index 523f532..410c55f 100644
--- a/drivers/net/wireless/rsi/rsi_91x_ps.c
+++ b/drivers/net/wireless/rsi/rsi_91x_ps.c
@@ -16,7 +16,6 @@
 
 #include 
 #include 
-#include 
 #include "rsi_debugfs.h"
 #include "rsi_mgmt.h"
 #include "rsi_common.h"





[PATCH net-next] ath6kl: fix warning for using 0 as NULL

2017-01-11 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fixes the following sparse warning:

drivers/net/wireless/ath/ath6kl/sdio.c:716:55: warning:
 Using plain integer as NULL pointer

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/net/wireless/ath/ath6kl/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c 
b/drivers/net/wireless/ath/ath6kl/sdio.c
index 8ec66e7..2195b1b 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -713,7 +713,7 @@ static void ath6kl_sdio_cleanup_scatter(struct ath6kl *ar)
 * that the packet is properly freed?
 */
if (s_req->busrequest) {
-   s_req->busrequest->scat_req = 0;
+   s_req->busrequest->scat_req = NULL;
ath6kl_sdio_free_bus_req(ar_sdio, s_req->busrequest);
}
kfree(s_req->virt_dma_buf);





[PATCH -next] mwifiex: fix missing destroy_workqueue() on error in mwifiex_add_virtual_intf()

2016-09-29 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Add the missing destroy_workqueue() before return from
mwifiex_add_virtual_intf() in the error handling case.

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 39ce76a..5fd5876 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3016,6 +3016,8 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct 
wiphy *wiphy,
priv->netdev = NULL;
memset(>wdev, 0, sizeof(priv->wdev));
priv->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED;
+   destroy_workqueue(priv->dfs_cac_workqueue);
+   priv->dfs_cac_workqueue = NULL;
return ERR_PTR(-ENOMEM);
}
 





[PATCH -next] wlcore: sdio: drop kfree for memory allocated with devm_kzalloc

2016-09-28 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

It's not necessary to free memory allocated with devm_kzalloc
and using kfree leads to a double free.

Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data")
Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/net/wireless/ti/wlcore/sdio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c 
b/drivers/net/wireless/ti/wlcore/sdio.c
index a6e94b1..47fe7f9 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -391,7 +391,6 @@ static void wl1271_remove(struct sdio_func *func)
pm_runtime_get_noresume(>dev);
 
platform_device_unregister(glue->core);
-   kfree(glue);
 }
 
 #ifdef CONFIG_PM



[PATCH -next] ath10k: fix error return code in ahb

2016-09-16 Thread Wei Yongjun
From: Wei Yongjun <weiyongj...@huawei.com>

Fix to return a negative error code from the error handling case
instead of 0, as done elsewhere in function ath10k_ahb_probe() or
ath10k_ahb_resource_init().

Signed-off-by: Wei Yongjun <weiyongj...@huawei.com>
---
 drivers/net/wireless/ath/ath10k/ahb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index b99ad5d..6dc1c60 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -572,6 +572,7 @@ static int ath10k_ahb_resource_init(struct ath10k *ar)
ar_ahb->irq = platform_get_irq_byname(pdev, "legacy");
if (ar_ahb->irq < 0) {
ath10k_err(ar, "failed to get irq number: %d\n", ar_ahb->irq);
+   ret = ar_ahb->irq;
goto err_clock_deinit;
}
 
@@ -850,6 +851,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
if (chip_id == 0x) {
ath10k_err(ar, "failed to get chip id\n");
+   ret = -ENODEV;
goto err_halt_device;
}



[PATCH -next] wlcore: spi: fix non static symbol warning

2016-07-22 Thread Wei Yongjun
Fixes the following sparse warning:

drivers/net/wireless/ti/wlcore/spi.c:87:34: warning:
 symbol 'wilink_data' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyj...@gmail.com>
---
 drivers/net/wireless/ti/wlcore/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 6d24040..0ed526e 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -84,7 +84,7 @@ struct wilink_familiy_data {
char name[8];
 };
 
-const struct wilink_familiy_data *wilink_data;
+static const struct wilink_familiy_data *wilink_data;
 
 static const struct wilink_familiy_data wl18xx_data = {
.name = "wl18xx",

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html