* Re: [syzbot] [wireless?] WARNING in rate_control_rate_init (2)
2023-07-02 15:15 [syzbot] [wireless?] WARNING in rate_control_rate_init (2) syzbot
@ 2023-11-28 23:57 ` syzbot
2023-11-29 3:06 ` [syzbot] [wireless?] WARNING in rate_control_rate_init syzbot
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-28 23:57 UTC (permalink / raw)
To: davem, edumazet, johannes.berg, johannes, kuba, linux-kernel,
linux-wireless, llvm, nathan, ndesaulniers, netdev, pabeni,
syzkaller-bugs, trix
syzbot has bisected this issue to:
commit b303835dabe0340f932ebb4e260d2229f79b0684
Author: Johannes Berg <johannes.berg@intel.com>
Date: Sat Jul 23 20:08:49 2022 +0000
wifi: mac80211: accept STA changes without link changes
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=125a86dce80000
start commit: a214724554ae Merge tag 'wireless-next-2023-11-27' of git:/..
git tree: net-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=115a86dce80000
console output: https://syzkaller.appspot.com/x/log.txt?x=165a86dce80000
kernel config: https://syzkaller.appspot.com/x/.config?x=abf6d5a82dab01fe
dashboard link: https://syzkaller.appspot.com/bug?extid=62d7eef57b09bfebcd84
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10a4fc64e80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1363b22ce80000
Reported-by: syzbot+62d7eef57b09bfebcd84@syzkaller.appspotmail.com
Fixes: b303835dabe0 ("wifi: mac80211: accept STA changes without link changes")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [syzbot] [wireless?] WARNING in rate_control_rate_init
2023-07-02 15:15 [syzbot] [wireless?] WARNING in rate_control_rate_init (2) syzbot
2023-11-28 23:57 ` syzbot
@ 2023-11-29 3:06 ` syzbot
2023-11-29 4:04 ` syzbot
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-29 3:06 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [wireless?] WARNING in rate_control_rate_init
Author: eadavis@qq.com
please test WARNING in rate_control_rate_init
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6e2332e0ab53
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 606b1b2e4123..13d52452a124 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1796,7 +1796,7 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
!params->supported_rates_len &&
!params->ht_capa && !params->vht_capa &&
!params->he_capa && !params->eht_capa &&
- !params->opmode_notif_used)
+ !params->opmode_notif_used && 0)
return 0;
if (!link || !link_sta)
@@ -1817,6 +1817,7 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
} else if (new_link) {
return -EINVAL;
}
+ printk("b, %p \n", rcu_access_pointer(sdata->vif.bss_conf.chanctx_conf));
if (params->txpwr_set) {
link_sta->pub->txpwr.type = params->txpwr.type;
@@ -1868,6 +1869,7 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
params->opmode_notif,
sband->band);
}
+ printk("e, %p \n", rcu_access_pointer(sdata->vif.bss_conf.chanctx_conf));
return ret;
}
@@ -1982,6 +1984,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (params->listen_interval >= 0)
sta->listen_interval = params->listen_interval;
+ printk("b, stp: %d, sa: %d, src: %d\n",
+ test_sta_flag(sta, WLAN_STA_TDLS_PEER),
+ test_sta_flag(sta, WLAN_STA_ASSOC),
+ test_sta_flag(sta, WLAN_STA_RATE_CONTROL));
ret = sta_link_apply_parameters(local, sta, false,
¶ms->link_sta_params);
if (ret)
@@ -1996,6 +2002,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (params->airtime_weight)
sta->airtime_weight = params->airtime_weight;
+ printk("a, stp: %d, sa: %d, src: %d\n",
+ test_sta_flag(sta, WLAN_STA_TDLS_PEER),
+ test_sta_flag(sta, WLAN_STA_ASSOC),
+ test_sta_flag(sta, WLAN_STA_RATE_CONTROL));
/* set the STA state after all sta info from usermode has been set */
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) ||
set & BIT(NL80211_STA_FLAG_ASSOCIATED)) {
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [syzbot] [wireless?] WARNING in rate_control_rate_init
2023-07-02 15:15 [syzbot] [wireless?] WARNING in rate_control_rate_init (2) syzbot
2023-11-28 23:57 ` syzbot
2023-11-29 3:06 ` [syzbot] [wireless?] WARNING in rate_control_rate_init syzbot
@ 2023-11-29 4:04 ` syzbot
[not found] ` <tencent_0CCA1979CFA30DC8A5CF8DDC92365DCE5D07@qq.com>
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-29 4:04 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [wireless?] WARNING in rate_control_rate_init
Author: eadavis@qq.com
please test WARNING in rate_control_rate_init
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6e2332e0ab53
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 606b1b2e4123..e97ed85b7723 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1787,22 +1787,12 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
rcu_dereference_protected(sta->link[link_id],
lockdep_is_held(&local->hw.wiphy->mtx));
- /*
- * If there are no changes, then accept a link that doesn't exist,
- * unless it's a new link.
- */
- if (params->link_id < 0 && !new_link &&
- !params->link_mac && !params->txpwr_set &&
- !params->supported_rates_len &&
- !params->ht_capa && !params->vht_capa &&
- !params->he_capa && !params->eht_capa &&
- !params->opmode_notif_used)
- return 0;
-
+ printk("%p, %p, %d\n", link, link_sta, new_link);
if (!link || !link_sta)
return -EINVAL;
sband = ieee80211_get_link_sband(link);
+ printk("%p\n", sband);
if (!sband)
return -EINVAL;
@@ -1812,11 +1802,23 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
memcpy(link_sta->pub->addr, params->link_mac, ETH_ALEN);
} else if (!ether_addr_equal(link_sta->addr,
params->link_mac)) {
+ printk("%s\n", __func__);
return -EINVAL;
}
} else if (new_link) {
return -EINVAL;
}
+ /*
+ * If there are no changes, then accept a link that doesn't exist,
+ * unless it's a new link.
+ */
+ if (params->link_id < 0 && !new_link &&
+ !params->link_mac && !params->txpwr_set &&
+ !params->supported_rates_len &&
+ !params->ht_capa && !params->vht_capa &&
+ !params->he_capa && !params->eht_capa &&
+ !params->opmode_notif_used)
+ return 0;
if (params->txpwr_set) {
link_sta->pub->txpwr.type = params->txpwr.type;
@@ -1982,6 +1985,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (params->listen_interval >= 0)
sta->listen_interval = params->listen_interval;
+ printk("b, stp: %d, sa: %d, src: %d\n",
+ test_sta_flag(sta, WLAN_STA_TDLS_PEER),
+ test_sta_flag(sta, WLAN_STA_ASSOC),
+ test_sta_flag(sta, WLAN_STA_RATE_CONTROL));
ret = sta_link_apply_parameters(local, sta, false,
¶ms->link_sta_params);
if (ret)
@@ -1996,6 +2003,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (params->airtime_weight)
sta->airtime_weight = params->airtime_weight;
+ printk("a, stp: %d, sa: %d, src: %d\n",
+ test_sta_flag(sta, WLAN_STA_TDLS_PEER),
+ test_sta_flag(sta, WLAN_STA_ASSOC),
+ test_sta_flag(sta, WLAN_STA_RATE_CONTROL));
/* set the STA state after all sta info from usermode has been set */
if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) ||
set & BIT(NL80211_STA_FLAG_ASSOCIATED)) {
^ permalink raw reply [flat|nested] 9+ messages in thread[parent not found: <tencent_0CCA1979CFA30DC8A5CF8DDC92365DCE5D07@qq.com>]
* Re: [PATCH] wifi: mac80211: sband's null check should precede params
[not found] ` <tencent_0CCA1979CFA30DC8A5CF8DDC92365DCE5D07@qq.com>
@ 2023-11-29 6:57 ` Johannes Berg
[not found] ` <tencent_DE78F66DB82F496F9894B8E826EC8ACE0C0A@qq.com>
0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2023-11-29 6:57 UTC (permalink / raw)
To: Edward Adam Davis, syzbot+62d7eef57b09bfebcd84
Cc: davem, edumazet, kuba, linux-kernel, linux-wireless, llvm,
nathan, ndesaulniers, netdev, pabeni, syzkaller-bugs, trix
On Wed, 2023-11-29 at 13:48 +0800, Edward Adam Davis wrote:
>
> [Analysis]
> When ieee80211_get_link_sband() fails to find a valid sband and first checks
> for params in sta_link_apply_parameters(), it will return 0 due to new_link
> being 0, which will lead to an incorrect process after sta_apply_parameters().
>
> [Fix]
> First obtain sband and perform a non null check before checking the params.
Not sure I can even disagree with that analysis, it seems right, but ...
> + if (!link || !link_sta)
> + return -EINVAL;
> +
> + sband = ieee80211_get_link_sband(link);
> + if (!sband)
> + return -EINVAL;
> +
> /*
> * If there are no changes, then accept a link that doesn't exist,
> * unless it's a new link.
There's a comment here which is clearly not true after this change,
since you've already returned for !link_sta?
johannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [syzbot] [wireless?] WARNING in rate_control_rate_init
2023-07-02 15:15 [syzbot] [wireless?] WARNING in rate_control_rate_init (2) syzbot
` (3 preceding siblings ...)
[not found] ` <tencent_0CCA1979CFA30DC8A5CF8DDC92365DCE5D07@qq.com>
@ 2023-11-29 11:04 ` syzbot
2023-11-29 11:26 ` syzbot
5 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-29 11:04 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [wireless?] WARNING in rate_control_rate_init
Author: eadavis@qq.com
please test WARNING in rate_control_rate_init
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6e2332e0ab53
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 606b1b2e4123..d0b5a5dd7410 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1788,10 +1788,10 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
lockdep_is_held(&local->hw.wiphy->mtx));
/*
- * If there are no changes, then accept a link that doesn't exist,
+ * If there are no changes, then accept a link that exist,
* unless it's a new link.
*/
- if (params->link_id < 0 && !new_link &&
+ if ((sta->sta.valid_links & BIT(params->link_id)) && !new_link &&
!params->link_mac && !params->txpwr_set &&
!params->supported_rates_len &&
!params->ht_capa && !params->vht_capa &&
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [syzbot] [wireless?] WARNING in rate_control_rate_init
2023-07-02 15:15 [syzbot] [wireless?] WARNING in rate_control_rate_init (2) syzbot
` (4 preceding siblings ...)
2023-11-29 11:04 ` [syzbot] [wireless?] WARNING in rate_control_rate_init syzbot
@ 2023-11-29 11:26 ` syzbot
5 siblings, 0 replies; 9+ messages in thread
From: syzbot @ 2023-11-29 11:26 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [wireless?] WARNING in rate_control_rate_init
Author: eadavis@qq.com
please test WARNING in rate_control_rate_init
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 6e2332e0ab53
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 606b1b2e4123..d0b5a5dd7410 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1788,10 +1788,10 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
lockdep_is_held(&local->hw.wiphy->mtx));
/*
- * If there are no changes, then accept a link that doesn't exist,
+ * If there are no changes, then accept a link that exist,
* unless it's a new link.
*/
- if (params->link_id < 0 && !new_link &&
+ if (params->link_id >= 0 && !new_link &&
!params->link_mac && !params->txpwr_set &&
!params->supported_rates_len &&
!params->ht_capa && !params->vht_capa &&
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread