* [PATCH 2/2] rsi: update some comments
2017-08-25 8:43 [PATCH 1/2] rsi: missing unlocks on error paths Dan Carpenter
@ 2017-08-25 8:40 ` Dan Carpenter
2017-08-30 16:49 ` [2/2] " Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-08-25 8:40 UTC (permalink / raw)
To: Kalle Valo
Cc: Prameela Rani Garnepudi, Amitkumar Karwar, Karun Eagalapati,
Johannes Berg, Andrew Zaborowski, linux-wireless, kernel-janitors
These functions don't return -1 on failure.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 25331aa16e8e..e78e87e99804 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -754,7 +754,7 @@ static int rsi_mac80211_conf_tx(struct ieee80211_hw *hw,
* @vif: Pointer to the ieee80211_vif structure.
* @key: Pointer to the ieee80211_key_conf structure.
*
- * Return: status: 0 on success, -1 on failure.
+ * Return: status: 0 on success, negative error codes on failure.
*/
static int rsi_hal_key_config(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
@@ -1194,7 +1194,7 @@ static void rsi_set_min_rate(struct ieee80211_hw *hw,
* @vif: Pointer to the ieee80211_vif structure.
* @sta: Pointer to the ieee80211_sta structure.
*
- * Return: 0 on success, -1 on failure.
+ * Return: 0 on success, negative error codes on failure.
*/
static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
@@ -1306,7 +1306,7 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
* @vif: Pointer to the ieee80211_vif structure.
* @sta: Pointer to the ieee80211_sta structure.
*
- * Return: 0 on success, -1 on failure.
+ * Return: 0 on success, negative error codes on failure.
*/
static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
@@ -1426,7 +1426,7 @@ static int rsi_mac80211_set_antenna(struct ieee80211_hw *hw,
* @tx_ant: Bitmap for tx antenna
* @rx_ant: Bitmap for rx antenna
*
- * Return: 0 on success, -1 on failure.
+ * Return: 0 on success, negative error codes on failure.
*/
static int rsi_mac80211_get_antenna(struct ieee80211_hw *hw,
u32 *tx_ant, u32 *rx_ant)
@@ -1533,7 +1533,7 @@ static struct ieee80211_ops mac80211_ops = {
* rsi_mac80211_attach() - This function is used to initialize Mac80211 stack.
* @common: Pointer to the driver private structure.
*
- * Return: 0 on success, -1 on failure.
+ * Return: 0 on success, negative error codes on failure.
*/
int rsi_mac80211_attach(struct rsi_common *common)
{
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/2] rsi: missing unlocks on error paths
@ 2017-08-25 8:43 Dan Carpenter
2017-08-25 8:40 ` [PATCH 2/2] rsi: update some comments Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-08-25 8:43 UTC (permalink / raw)
To: Kalle Valo, Prameela Rani Garnepudi
Cc: Amitkumar Karwar, Karun Eagalapati, Andrew Zaborowski,
linux-wireless, kernel-janitors
There is a missing unlock if rsi_find_sta() fails in
rsi_mac80211_ampdu_action() or if we hit the -EINVAL path in
rsi_mac80211_sta_add().
Fixes: 3528608f3a79 ("rsi: handle station connection in AP mode")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 8b983d03f2da..25331aa16e8e 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -906,7 +906,8 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw,
rsta = rsi_find_sta(common, sta->addr);
if (!rsta) {
rsi_dbg(ERR_ZONE, "No station mapped\n");
- return 0;
+ status = 0;
+ goto unlock;
}
sta_id = rsta->sta_id;
}
@@ -974,6 +975,7 @@ static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw,
break;
}
+unlock:
mutex_unlock(&common->mutex);
return status;
}
@@ -1202,6 +1204,7 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
struct rsi_common *common = adapter->priv;
bool sta_exist = false;
struct rsi_sta *rsta;
+ int status = 0;
rsi_dbg(INFO_ZONE, "Station Add: %pM\n", sta->addr);
@@ -1215,8 +1218,8 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
/* Check if max stations reached */
if (common->num_stations >= common->max_stations) {
rsi_dbg(ERR_ZONE, "Reject: Max Stations exists\n");
- mutex_unlock(&common->mutex);
- return -EOPNOTSUPP;
+ status = -EOPNOTSUPP;
+ goto unlock;
}
for (cnt = 0; cnt < common->max_stations; cnt++) {
rsta = &common->stations[cnt];
@@ -1241,7 +1244,8 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
rsi_dbg(ERR_ZONE,
"%s: Some problem reaching here...\n",
__func__);
- return -EINVAL;
+ status = -EINVAL;
+ goto unlock;
}
rsta = &common->stations[sta_idx];
rsta->sta = sta;
@@ -1289,9 +1293,10 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
}
}
+unlock:
mutex_unlock(&common->mutex);
- return 0;
+ return status;
}
/**
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [2/2] rsi: update some comments
2017-08-25 8:40 ` [PATCH 2/2] rsi: update some comments Dan Carpenter
@ 2017-08-30 16:49 ` Kalle Valo
0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2017-08-30 16:49 UTC (permalink / raw)
To: Dan Carpenter
Cc: Prameela Rani Garnepudi, Amitkumar Karwar, Karun Eagalapati,
Johannes Berg, Andrew Zaborowski, linux-wireless, kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> These functions don't return -1 on failure.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
> index 25331aa16e8e..e78e87e99804 100644
> --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
> @@ -754,7 +754,7 @@ static int rsi_mac80211_conf_tx(struct ieee80211_hw *hw,
> * @vif: Pointer to the ieee80211_vif structure.
> * @key: Pointer to the ieee80211_key_conf structure.
> *
> - * Return: status: 0 on success, -1 on failure.
> + * Return: status: 0 on success, negative error codes on failure.
> */
> static int rsi_hal_key_config(struct ieee80211_hw *hw,
> struct ieee80211_vif *vif,
> @@ -1194,7 +1194,7 @@ static void rsi_set_min_rate(struct ieee80211_hw *hw,
> * @vif: Pointer to the ieee80211_vif structure.
> * @sta: Pointer to the ieee80211_sta structure.
> *
> - * Return: 0 on success, -1 on failure.
> + * Return: 0 on success, negative error codes on failure.
> */
> static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
> struct ieee80211_vif *vif,
> @@ -1306,7 +1306,7 @@ static int rsi_mac80211_sta_add(struct ieee80211_hw *hw,
> * @vif: Pointer to the ieee80211_vif structure.
> * @sta: Pointer to the ieee80211_sta structure.
> *
> - * Return: 0 on success, -1 on failure.
> + * Return: 0 on success, negative error codes on failure.
> */
> static int rsi_mac80211_sta_remove(struct ieee80211_hw *hw,
> struct ieee80211_vif *vif,
> @@ -1426,7 +1426,7 @@ static int rsi_mac80211_set_antenna(struct ieee80211_hw *hw,
> * @tx_ant: Bitmap for tx antenna
> * @rx_ant: Bitmap for rx antenna
> *
> - * Return: 0 on success, -1 on failure.
> + * Return: 0 on success, negative error codes on failure.
> */
> static int rsi_mac80211_get_antenna(struct ieee80211_hw *hw,
> u32 *tx_ant, u32 *rx_ant)
> @@ -1533,7 +1533,7 @@ static struct ieee80211_ops mac80211_ops = {
> * rsi_mac80211_attach() - This function is used to initialize Mac80211 stack.
> * @common: Pointer to the driver private structure.
> *
> - * Return: 0 on success, -1 on failure.
> + * Return: 0 on success, negative error codes on failure.
> */
> int rsi_mac80211_attach(struct rsi_common *common)
> {
2 patches applied to wireless-drivers-next.git, thanks.
fc4386729491 rsi: update some comments
0270639e899e rsi: missing unlocks on error paths
--
https://patchwork.kernel.org/patch/9921425/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-30 16:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25 8:43 [PATCH 1/2] rsi: missing unlocks on error paths Dan Carpenter
2017-08-25 8:40 ` [PATCH 2/2] rsi: update some comments Dan Carpenter
2017-08-30 16:49 ` [2/2] " Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).