diff mbox series

wifi: rtlwifi: rtl8821ae: phy: restore removed code to fix infinite loop

Message ID 20241106154642.1627886-1-colin.i.king@gmail.com (mailing list archive)
State New
Delegated to: Ping-Ke Shih
Headers show
Series wifi: rtlwifi: rtl8821ae: phy: restore removed code to fix infinite loop | expand

Commit Message

Colin Ian King Nov. 6, 2024, 3:46 p.m. UTC
A previous clean-up fix removed the assignment of v2 inside a while loop
that turned it into an infinite loop. Fix this by restoring the assignment
of v2 from array[] so that v2 is updated inside the loop.

Fixes: cda37445718d ("wifi: rtlwifi: rtl8821ae: phy: remove some useless code")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ping-Ke Shih Nov. 7, 2024, 12:51 a.m. UTC | #1
Colin Ian King <colin.i.king@gmail.com> wrote:
> A previous clean-up fix removed the assignment of v2 inside a while loop
> that turned it into an infinite loop. Fix this by restoring the assignment
> of v2 from array[] so that v2 is updated inside the loop.
> 
> Fixes: cda37445718d ("wifi: rtlwifi: rtl8821ae: phy: remove some useless code")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

I tested RTL8812AE/8821AE. Luckily, parsing current PHY register parameters
never falls into the check condition. 

Tested-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
>  drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> index 1be51ea3f3c8..0d4d787e8be5 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> @@ -2033,8 +2033,10 @@ static bool _rtl8821ae_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
>                         if (!_rtl8821ae_check_condition(hw, v1)) {
>                                 i += 2; /* skip the pair of expression*/
>                                 v2 = array[i+1];
> -                               while (v2 != 0xDEAD)
> +                               while (v2 != 0xDEAD) {
>                                         i += 3;
> +                                       v2 = array[i + 1];
> +                               }
>                         }
>                 }
>         }
> --
> 2.39.5
Su Hui Nov. 7, 2024, 1:14 a.m. UTC | #2
On 2024/11/7 08:51, Ping-Ke Shih wrote:
> Colin Ian King <colin.i.king@gmail.com> wrote:
>> A previous clean-up fix removed the assignment of v2 inside a while loop
>> that turned it into an infinite loop. Fix this by restoring the assignment
>> of v2 from array[] so that v2 is updated inside the loop.
>>
>> Fixes: cda37445718d ("wifi: rtlwifi: rtl8821ae: phy: remove some useless code")
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Thanks for your correction. I'm sorry for this stupid mistake.

Reviewed-by: Su Hui <suhui@nfschina.com>

> I tested RTL8812AE/8821AE. Luckily, parsing current PHY register parameters
> never falls into the check condition.
>
> Tested-by: Ping-Ke Shih <pkshih@realtek.com>
>> ---
>>   drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
>> b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
>> index 1be51ea3f3c8..0d4d787e8be5 100644
>> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
>> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
>> @@ -2033,8 +2033,10 @@ static bool _rtl8821ae_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
>>                          if (!_rtl8821ae_check_condition(hw, v1)) {
>>                                  i += 2; /* skip the pair of expression*/
>>                                  v2 = array[i+1];
>> -                               while (v2 != 0xDEAD)
>> +                               while (v2 != 0xDEAD) {
>>                                          i += 3;
>> +                                       v2 = array[i + 1];
>> +                               }
>>                          }
>>                  }
>>          }
>> --
>> 2.39.5
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index 1be51ea3f3c8..0d4d787e8be5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -2033,8 +2033,10 @@  static bool _rtl8821ae_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
 			if (!_rtl8821ae_check_condition(hw, v1)) {
 				i += 2; /* skip the pair of expression*/
 				v2 = array[i+1];
-				while (v2 != 0xDEAD)
+				while (v2 != 0xDEAD) {
 					i += 3;
+					v2 = array[i + 1];
+				}
 			}
 		}
 	}