[syzbot] [wireless?] WARNING in sta_info_insert_rcu (3)

6 views
Skip to first unread message

syzbot

unread,
Jul 15, 2023, 12:59:02 PM7/15/23
to da...@davemloft.net, ebie...@xmission.com, edum...@google.com, hbh...@gmail.com, joha...@sipsolutions.net, ku...@kernel.org, linux-...@vger.kernel.org, linux-w...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f01e9fed845 Merge tag 'linux-watchdog-6.5-rc2' of git://w..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=11089df2a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=150188feee7071a7
dashboard link: https://syzkaller.appspot.com/bug?extid=2676771ed06a6df166ad
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=122f5682a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=158dbaeca80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/47d90db1f2d1/disk-3f01e9fe.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/266e07b43566/vmlinux-3f01e9fe.xz
kernel image: https://storage.googleapis.com/syzbot-assets/62efdb874ac7/bzImage-3f01e9fe.xz

The issue was bisected to:

commit c579d60f0d0cd87552f64fdebe68b5d941d20309
Author: Hangyu Hua <hbh...@gmail.com>
Date: Fri Jul 15 06:23:01 2022 +0000

ipc: mqueue: fix possible memory leak in init_mqueue_fs()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=14a40b58a80000
final oops: https://syzkaller.appspot.com/x/report.txt?x=16a40b58a80000
console output: https://syzkaller.appspot.com/x/log.txt?x=12a40b58a80000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+267677...@syzkaller.appspotmail.com
Fixes: c579d60f0d0c ("ipc: mqueue: fix possible memory leak in init_mqueue_fs()")

wlan1: authenticate with 08:02:11:00:00:01
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1148 at net/mac80211/sta_info.c:728 sta_info_insert_check net/mac80211/sta_info.c:728 [inline]
WARNING: CPU: 1 PID: 1148 at net/mac80211/sta_info.c:728 sta_info_insert_rcu+0x25e/0x1af0 net/mac80211/sta_info.c:940
Modules linked in:
CPU: 1 PID: 1148 Comm: kworker/1:2 Not tainted 6.5.0-rc1-syzkaller-00006-g3f01e9fed845 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
Workqueue: events cfg80211_conn_work
RIP: 0010:sta_info_insert_check net/mac80211/sta_info.c:728 [inline]
RIP: 0010:sta_info_insert_rcu+0x25e/0x1af0 net/mac80211/sta_info.c:940
Code: e8 a7 14 ef f7 44 89 e0 31 ff 83 e0 01 89 c6 88 44 24 08 e8 74 10 ef f7 0f b6 44 24 08 84 c0 0f 84 19 01 00 00 e8 82 14 ef f7 <0f> 0b c7 44 24 08 ea ff ff ff e8 73 14 ef f7 48 8b 7c 24 28 4c 89
RSP: 0018:ffffc90005bff1f0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888027478c80 RCX: 0000000000000000
RDX: ffff888021f78000 RSI: ffffffff8995cd3e RDI: 0000000000000005
RBP: 0000000000000100 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 000000000000000f R12: 0000000000110208
R13: ffff8880768fc048 R14: ffff88807d171730 R15: ffff8880768fc000
FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8913442270 CR3: 000000000c775000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
sta_info_insert+0x17/0xd0 net/mac80211/sta_info.c:953
ieee80211_prep_connection+0x5fd/0x14a0 net/mac80211/mlme.c:7047
ieee80211_mgd_auth+0x891/0x1170 net/mac80211/mlme.c:7205
rdev_auth net/wireless/rdev-ops.h:481 [inline]
cfg80211_mlme_auth+0x3b3/0x8c0 net/wireless/mlme.c:284
cfg80211_conn_do_work+0xd3c/0xff0 net/wireless/sme.c:181
cfg80211_conn_work+0x27f/0x3d0 net/wireless/sme.c:273
process_one_work+0xa34/0x16f0 kernel/workqueue.c:2597
worker_thread+0x67d/0x10c0 kernel/workqueue.c:2748
kthread+0x344/0x440 kernel/kthread.c:389
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Hillf Danton

unread,
Jul 15, 2023, 10:03:20 PM7/15/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Sat, 15 Jul 2023 09:59:00 -0700
> HEAD commit: 3f01e9fed845 Merge tag 'linux-watchdog-6.5-rc2' of git://w..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=158dbaeca80000

Check ether addr before inserting sta.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3f01e9fed845

--- x/net/mac80211/sta_info.c
+++ y/net/mac80211/sta_info.c
@@ -937,7 +937,13 @@ int sta_info_insert_rcu(struct sta_info

mutex_lock(&local->sta_mtx);

- err = sta_info_insert_check(sta);
+ err = 0;
+ if (ether_addr_equal(sta->sta.addr, sta->sdata->vif.addr) ||
+ !is_valid_ether_addr(sta->sta.addr))
+ err = -EINVAL;
+
+ if (!err)
+ err = sta_info_insert_check(sta);
if (err) {
sta_info_free(local, sta);
mutex_unlock(&local->sta_mtx);
--

syzbot

unread,
Jul 15, 2023, 10:39:31 PM7/15/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in ieee80211_link_release_channel

wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
wlan1: authenticate with 08:02:11:00:00:01
wlan1: failed to insert STA entry for the AP (error -22)
------------[ cut here ]------------
WARNING: CPU: 1 PID: 5411 at net/mac80211/chan.c:2021 ieee80211_link_release_channel+0x19f/0x200 net/mac80211/chan.c:2021
Modules linked in:
CPU: 1 PID: 5411 Comm: kworker/1:4 Not tainted 6.5.0-rc1-syzkaller-00006-g3f01e9fed845-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
Workqueue: events cfg80211_conn_work
RIP: 0010:ieee80211_link_release_channel+0x19f/0x200 net/mac80211/chan.c:2021
Code: ff ff ff ff 48 8d b8 f0 1c 00 00 e8 db 25 78 00 31 ff 41 89 c5 89 c6 e8 af de d7 f7 45 85 ed 0f 85 6d ff ff ff e8 31 e3 d7 f7 <0f> 0b e9 61 ff ff ff 48 c7 c7 70 b3 ab 8e e8 5e 76 2b f8 e9 3a ff
RSP: 0018:ffffc9000531f2a0 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888077f0e3a8 RCX: 0000000000000000
RDX: ffff88801f54d940 RSI: ffffffff89add36f RDI: 0000000000000005
RBP: ffff888077f0cc80 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 000000000000001f R12: ffff888077f0d580
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055caf027a950 CR3: 000000002c7e4000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
ieee80211_prep_connection+0x62a/0x14f0 net/mac80211/mlme.c:7065
ieee80211_mgd_auth+0xa1a/0x1470 net/mac80211/mlme.c:7205
rdev_auth net/wireless/rdev-ops.h:481 [inline]
cfg80211_mlme_auth+0x3b3/0x710 net/wireless/mlme.c:284
cfg80211_conn_do_work+0x64e/0xfe0 net/wireless/sme.c:181
cfg80211_conn_work+0x27f/0x3d0 net/wireless/sme.c:273
process_one_work+0xaa2/0x16f0 kernel/workqueue.c:2597
worker_thread+0x687/0x1110 kernel/workqueue.c:2748
kthread+0x33a/0x430 kernel/kthread.c:389
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
</TASK>


Tested on:

commit: 3f01e9fe Merge tag 'linux-watchdog-6.5-rc2' of git://w..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1738ebe4a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=87ef4ae61b35aae1
dashboard link: https://syzkaller.appspot.com/bug?extid=2676771ed06a6df166ad
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1684f646a80000

Hillf Danton

unread,
Jul 16, 2023, 2:25:17 AM7/16/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Sat, 15 Jul 2023 09:59:00 -0700
> HEAD commit: 3f01e9fed845 Merge tag 'linux-watchdog-6.5-rc2' of git://w..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=158dbaeca80000

Check ether addr before inserting sta.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3f01e9fed845

--- x/net/mac80211/sta_info.c
+++ y/net/mac80211/sta_info.c
@@ -937,7 +937,13 @@ int sta_info_insert_rcu(struct sta_info

mutex_lock(&local->sta_mtx);

- err = sta_info_insert_check(sta);
+ err = 0;
+ if (ether_addr_equal(sta->sta.addr, sta->sdata->vif.addr) ||
+ !is_valid_ether_addr(sta->sta.addr))
+ err = -EINVAL;
+
+ if (!err)
+ err = sta_info_insert_check(sta);
if (err) {
sta_info_free(local, sta);
mutex_unlock(&local->sta_mtx);
--- x/net/mac80211/mlme.c
+++ y/net/mac80211/mlme.c
@@ -7062,8 +7062,10 @@ static int ieee80211_prep_connection(str
return 0;

out_err:
+ mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink);
ieee80211_vif_set_links(sdata, 0, 0);
+ mutex_unlock(&sdata->local->mtx);
return err;
}

--

syzbot

unread,
Jul 16, 2023, 2:48:37 AM7/16/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+267677...@syzkaller.appspotmail.com

Tested on:

commit: 3f01e9fe Merge tag 'linux-watchdog-6.5-rc2' of git://w..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=12c30342a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=87ef4ae61b35aae1
dashboard link: https://syzkaller.appspot.com/bug?extid=2676771ed06a6df166ad
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1426f30aa80000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages