diff mbox series

[SRU,F,1/1] mt76: fix fix ampdu locking

Message ID 20201218091335.888061-2-shrirang.bagul@canonical.com
State New
Headers show
Series Fix instability in connecting to network with mt76 | expand

Commit Message

Shrirang Bagul Dec. 18, 2020, 9:13 a.m. UTC
From: Markus Theil <markus.theil@tu-ilmenau.de>

BugLink: https://bugs.launchpad.net/bugs/1906770

The current ampdu locking code does not unlock its mutex in the early
return case. This patch fixes it.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
(cherry picked from commit 05d6c8cfdbd6cefac6b373bad72775fcc4193c80)
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
---
 drivers/net/wireless/mediatek/mt76/mt7603/main.c  | 6 ++++--
 drivers/net/wireless/mediatek/mt76/mt7615/main.c  | 6 ++++--
 drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

Comments

Kleber Sacilotto de Souza Dec. 18, 2020, 11:28 a.m. UTC | #1
On 18.12.20 10:13, Shrirang Bagul wrote:
> From: Markus Theil <markus.theil@tu-ilmenau.de>
> 
> BugLink: https://bugs.launchpad.net/bugs/1906770
> 
> The current ampdu locking code does not unlock its mutex in the early
> return case. This patch fixes it.
> 
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> Acked-by: Felix Fietkau <nbd@nbd.name>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
> (cherry picked from commit 05d6c8cfdbd6cefac6b373bad72775fcc4193c80)
> Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>


Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>   drivers/net/wireless/mediatek/mt76/mt7603/main.c  | 6 ++++--
>   drivers/net/wireless/mediatek/mt76/mt7615/main.c  | 6 ++++--
>   drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 6 ++++--
>   3 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
> index cdd5f7d2e866..112014436716 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
> @@ -555,6 +555,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   	u16 ssn = params->ssn;
>   	u8 ba_size = params->buf_size;
>   	struct mt76_txq *mtxq;
> +	int ret = 0;
>   
>   	if (!txq)
>   		return -EINVAL;
> @@ -583,7 +584,8 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   		break;
>   	case IEEE80211_AMPDU_TX_START:
>   		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
> -		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		break;
>   	case IEEE80211_AMPDU_TX_STOP_CONT:
>   		mtxq->aggr = false;
>   		mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1);
> @@ -592,7 +594,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   	}
>   	mutex_unlock(&dev->mt76.mutex);
>   
> -	return 0;
> +	return ret;
>   }
>   
>   static void
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> index 760a22701ab9..9a9a5a8e5751 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> @@ -449,6 +449,7 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   	u16 tid = params->tid;
>   	u16 ssn = params->ssn;
>   	struct mt76_txq *mtxq;
> +	int ret = 0;
>   
>   	if (!txq)
>   		return -EINVAL;
> @@ -478,7 +479,8 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   		break;
>   	case IEEE80211_AMPDU_TX_START:
>   		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
> -		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		break;
>   	case IEEE80211_AMPDU_TX_STOP_CONT:
>   		mtxq->aggr = false;
>   		mt7615_mcu_set_tx_ba(dev, params, 0);
> @@ -487,7 +489,7 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   	}
>   	mutex_unlock(&dev->mt76.mutex);
>   
> -	return 0;
> +	return ret;
>   }
>   
>   const struct ieee80211_ops mt7615_ops = {
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> index 165187bbb8be..d10e15a147bb 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> @@ -365,6 +365,7 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   	u16 tid = params->tid;
>   	u16 ssn = params->ssn;
>   	struct mt76_txq *mtxq;
> +	int ret = 0;
>   
>   	if (!txq)
>   		return -EINVAL;
> @@ -394,7 +395,8 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   		break;
>   	case IEEE80211_AMPDU_TX_START:
>   		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
> -		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		break;
>   	case IEEE80211_AMPDU_TX_STOP_CONT:
>   		mtxq->aggr = false;
>   		ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
> @@ -402,7 +404,7 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   	}
>   	mutex_unlock(&dev->mt76.mutex);
>   
> -	return 0;
> +	return ret;
>   }
>   EXPORT_SYMBOL_GPL(mt76x02_ampdu_action);
>   
>
Ian May Dec. 18, 2020, 3:31 p.m. UTC | #2
Applied to focal/linux

Thanks,
Ian

On 2020-12-18 17:13:35 , Shrirang Bagul wrote:
> From: Markus Theil <markus.theil@tu-ilmenau.de>
> 
> BugLink: https://bugs.launchpad.net/bugs/1906770
> 
> The current ampdu locking code does not unlock its mutex in the early
> return case. This patch fixes it.
> 
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> Acked-by: Felix Fietkau <nbd@nbd.name>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
> (cherry picked from commit 05d6c8cfdbd6cefac6b373bad72775fcc4193c80)
> Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7603/main.c  | 6 ++++--
>  drivers/net/wireless/mediatek/mt76/mt7615/main.c  | 6 ++++--
>  drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 6 ++++--
>  3 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
> index cdd5f7d2e866..112014436716 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
> @@ -555,6 +555,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  	u16 ssn = params->ssn;
>  	u8 ba_size = params->buf_size;
>  	struct mt76_txq *mtxq;
> +	int ret = 0;
>  
>  	if (!txq)
>  		return -EINVAL;
> @@ -583,7 +584,8 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  		break;
>  	case IEEE80211_AMPDU_TX_START:
>  		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
> -		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		break;
>  	case IEEE80211_AMPDU_TX_STOP_CONT:
>  		mtxq->aggr = false;
>  		mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1);
> @@ -592,7 +594,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  	}
>  	mutex_unlock(&dev->mt76.mutex);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static void
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> index 760a22701ab9..9a9a5a8e5751 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> @@ -449,6 +449,7 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  	u16 tid = params->tid;
>  	u16 ssn = params->ssn;
>  	struct mt76_txq *mtxq;
> +	int ret = 0;
>  
>  	if (!txq)
>  		return -EINVAL;
> @@ -478,7 +479,8 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  		break;
>  	case IEEE80211_AMPDU_TX_START:
>  		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
> -		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		break;
>  	case IEEE80211_AMPDU_TX_STOP_CONT:
>  		mtxq->aggr = false;
>  		mt7615_mcu_set_tx_ba(dev, params, 0);
> @@ -487,7 +489,7 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  	}
>  	mutex_unlock(&dev->mt76.mutex);
>  
> -	return 0;
> +	return ret;
>  }
>  
>  const struct ieee80211_ops mt7615_ops = {
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> index 165187bbb8be..d10e15a147bb 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
> @@ -365,6 +365,7 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  	u16 tid = params->tid;
>  	u16 ssn = params->ssn;
>  	struct mt76_txq *mtxq;
> +	int ret = 0;
>  
>  	if (!txq)
>  		return -EINVAL;
> @@ -394,7 +395,8 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  		break;
>  	case IEEE80211_AMPDU_TX_START:
>  		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
> -		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
> +		break;
>  	case IEEE80211_AMPDU_TX_STOP_CONT:
>  		mtxq->aggr = false;
>  		ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
> @@ -402,7 +404,7 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  	}
>  	mutex_unlock(&dev->mt76.mutex);
>  
> -	return 0;
> +	return ret;
>  }
>  EXPORT_SYMBOL_GPL(mt76x02_ampdu_action);
>  
> -- 
> 2.25.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
index cdd5f7d2e866..112014436716 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c
@@ -555,6 +555,7 @@  mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	u16 ssn = params->ssn;
 	u8 ba_size = params->buf_size;
 	struct mt76_txq *mtxq;
+	int ret = 0;
 
 	if (!txq)
 		return -EINVAL;
@@ -583,7 +584,8 @@  mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		break;
 	case IEEE80211_AMPDU_TX_START:
 		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
-		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
+		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
+		break;
 	case IEEE80211_AMPDU_TX_STOP_CONT:
 		mtxq->aggr = false;
 		mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1);
@@ -592,7 +594,7 @@  mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	}
 	mutex_unlock(&dev->mt76.mutex);
 
-	return 0;
+	return ret;
 }
 
 static void
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 760a22701ab9..9a9a5a8e5751 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -449,6 +449,7 @@  mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	u16 tid = params->tid;
 	u16 ssn = params->ssn;
 	struct mt76_txq *mtxq;
+	int ret = 0;
 
 	if (!txq)
 		return -EINVAL;
@@ -478,7 +479,8 @@  mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		break;
 	case IEEE80211_AMPDU_TX_START:
 		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
-		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
+		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
+		break;
 	case IEEE80211_AMPDU_TX_STOP_CONT:
 		mtxq->aggr = false;
 		mt7615_mcu_set_tx_ba(dev, params, 0);
@@ -487,7 +489,7 @@  mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	}
 	mutex_unlock(&dev->mt76.mutex);
 
-	return 0;
+	return ret;
 }
 
 const struct ieee80211_ops mt7615_ops = {
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 165187bbb8be..d10e15a147bb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -365,6 +365,7 @@  int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	u16 tid = params->tid;
 	u16 ssn = params->ssn;
 	struct mt76_txq *mtxq;
+	int ret = 0;
 
 	if (!txq)
 		return -EINVAL;
@@ -394,7 +395,8 @@  int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		break;
 	case IEEE80211_AMPDU_TX_START:
 		mtxq->agg_ssn = IEEE80211_SN_TO_SEQ(ssn);
-		return IEEE80211_AMPDU_TX_START_IMMEDIATE;
+		ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;
+		break;
 	case IEEE80211_AMPDU_TX_STOP_CONT:
 		mtxq->aggr = false;
 		ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
@@ -402,7 +404,7 @@  int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	}
 	mutex_unlock(&dev->mt76.mutex);
 
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(mt76x02_ampdu_action);