syzbot


BUG: sleeping function called from invalid context in sta_info_move_state

Status: fixed on 2021/03/10 01:48
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+d5a9416c6cafe53b5dd0@syzkaller.appspotmail.com
Fix commit: 7bc40aedf24d mac80211: free sta in sta_info_insert_finish() on errors
First crash: 1512d, last: 1479d
Cause bisection: introduced by (bisect log) :
commit dcd479e10a0510522a5d88b29b8f79ea3467d501
Author: Johannes Berg <johannes.berg@intel.com>
Date: Fri Oct 9 12:17:11 2020 +0000

  mac80211: always wind down STA state

Crash: BUG: sleeping function called from invalid context in sta_info_move_state (log)
Repro: syz .config
  
Discussions (9)
Title Replies (including bot) Last reply
[PATCH 5.4 000/158] 5.4.80-rc1 review 166 (166) 2020/12/11 20:25
[PATCH 4.19 00/91] 4.19.160-rc1 review 98 (98) 2020/11/24 22:52
[PATCH 5.9 000/252] 5.9.11-rc1 review 259 (259) 2020/11/24 20:28
[PATCH 4.4 00/38] 4.4.246-rc1 review 43 (43) 2020/11/24 19:53
[PATCH 4.9 00/47] 4.9.246-rc1 review 51 (51) 2020/11/24 08:31
[PATCH 4.14 00/60] 4.14.209-rc1 review 63 (63) 2020/11/24 07:21
[PATCH] mac80211: free sta in sta_info_insert_finish() on errors 1 (1) 2020/11/12 10:22
[PATCH] mac80211: wind down station state earlier 2 (2) 2020/11/12 08:26
BUG: sleeping function called from invalid context in sta_info_move_state 0 (1) 2020/11/03 17:43
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 BUG: sleeping function called from invalid context in sta_info_move_state C done 760 1490d 1492d 1/1 fixed on 2020/12/25 08:46
linux-4.14 BUG: sleeping function called from invalid context in sta_info_move_state C done 1101 1490d 1492d 1/1 fixed on 2020/12/25 08:46
Last patch testing requests (1)
Created Duration User Patch Repo Result
2020/11/12 10:15 17m johannes@sipsolutions.net patch git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git f16e6313 OK

Sample crash report:
wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
BUG: sleeping function called from invalid context at net/mac80211/sta_info.c:1962
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 8, name: kworker/u4:0
4 locks held by kworker/u4:0/8:
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: atomic64_set include/asm-generic/atomic-instrumented.h:856 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:616 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:643 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: process_one_work+0x821/0x15a0 kernel/workqueue.c:2243
 #1: ffffc90000cefda8 ((work_completion)(&sdata->work)){+.+.}-{0:0}, at: process_one_work+0x854/0x15a0 kernel/workqueue.c:2247
 #2: ffff8880122f8d00 (&wdev->mtx){+.+.}-{3:3}, at: sdata_lock net/mac80211/ieee80211_i.h:1021 [inline]
 #2: ffff8880122f8d00 (&wdev->mtx){+.+.}-{3:3}, at: ieee80211_ibss_work+0x93/0xe80 net/mac80211/ibss.c:1683
 #3: ffffffff8b337060 (rcu_read_lock){....}-{1:2}, at: sta_info_insert_finish net/mac80211/sta_info.c:644 [inline]
 #3: ffffffff8b337060 (rcu_read_lock){....}-{1:2}, at: sta_info_insert_rcu+0x680/0x2ba0 net/mac80211/sta_info.c:732
Preemption disabled at:
[<ffffffff88e7264f>] __mutex_lock_common kernel/locking/mutex.c:955 [inline]
[<ffffffff88e7264f>] __mutex_lock+0x10f/0x10e0 kernel/locking/mutex.c:1103
CPU: 0 PID: 8 Comm: kworker/u4:0 Not tainted 5.10.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: phy3 ieee80211_iface_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:118
 ___might_sleep.cold+0x1e8/0x22e kernel/sched/core.c:7298
 sta_info_move_state+0x32/0x8d0 net/mac80211/sta_info.c:1962
 sta_info_free+0x65/0x3b0 net/mac80211/sta_info.c:274
 sta_info_insert_rcu+0x303/0x2ba0 net/mac80211/sta_info.c:738
 ieee80211_ibss_finish_sta+0x212/0x390 net/mac80211/ibss.c:592
 ieee80211_ibss_work+0x2c7/0xe80 net/mac80211/ibss.c:1700
 ieee80211_iface_work+0x82e/0x970 net/mac80211/iface.c:1476
 process_one_work+0x933/0x15a0 kernel/workqueue.c:2272
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2418
 kthread+0x3af/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

=============================
[ BUG: Invalid wait context ]
5.10.0-rc3-syzkaller #0 Tainted: G        W        
-----------------------------
kworker/u4:0/8 is trying to lock:
ffff88802a6929d0 (&local->chanctx_mtx){+.+.}-{3:3}, at: ieee80211_recalc_min_chandef+0x49/0x140 net/mac80211/util.c:2740
other info that might help us debug this:
context-{4:4}
4 locks held by kworker/u4:0/8:
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: atomic64_set include/asm-generic/atomic-instrumented.h:856 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:616 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:643 [inline]
 #0: ffff888011b1f138 ((wq_completion)phy3){+.+.}-{0:0}, at: process_one_work+0x821/0x15a0 kernel/workqueue.c:2243
 #1: ffffc90000cefda8 ((work_completion)(&sdata->work)){+.+.}-{0:0}, at: process_one_work+0x854/0x15a0 kernel/workqueue.c:2247
 #2: ffff8880122f8d00 (&wdev->mtx){+.+.}-{3:3}, at: sdata_lock net/mac80211/ieee80211_i.h:1021 [inline]
 #2: ffff8880122f8d00 (&wdev->mtx){+.+.}-{3:3}, at: ieee80211_ibss_work+0x93/0xe80 net/mac80211/ibss.c:1683
 #3: ffffffff8b337060 (rcu_read_lock){....}-{1:2}, at: sta_info_insert_finish net/mac80211/sta_info.c:644 [inline]
 #3: ffffffff8b337060 (rcu_read_lock){....}-{1:2}, at: sta_info_insert_rcu+0x680/0x2ba0 net/mac80211/sta_info.c:732
stack backtrace:
CPU: 0 PID: 8 Comm: kworker/u4:0 Tainted: G        W         5.10.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: phy3 ieee80211_iface_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:118
 print_lock_invalid_wait_context kernel/locking/lockdep.c:4483 [inline]
 check_wait_context kernel/locking/lockdep.c:4544 [inline]
 __lock_acquire.cold+0x310/0x3a2 kernel/locking/lockdep.c:4781
 lock_acquire kernel/locking/lockdep.c:5436 [inline]
 lock_acquire+0x2a3/0x8c0 kernel/locking/lockdep.c:5401
 __mutex_lock_common kernel/locking/mutex.c:956 [inline]
 __mutex_lock+0x134/0x10e0 kernel/locking/mutex.c:1103
 ieee80211_recalc_min_chandef+0x49/0x140 net/mac80211/util.c:2740
 sta_info_move_state+0x3cf/0x8d0 net/mac80211/sta_info.c:2019
 sta_info_free+0x65/0x3b0 net/mac80211/sta_info.c:274
 sta_info_insert_rcu+0x303/0x2ba0 net/mac80211/sta_info.c:738
 ieee80211_ibss_finish_sta+0x212/0x390 net/mac80211/ibss.c:592
 ieee80211_ibss_work+0x2c7/0xe80 net/mac80211/ibss.c:1700
 ieee80211_iface_work+0x82e/0x970 net/mac80211/iface.c:1476
 process_one_work+0x933/0x15a0 kernel/workqueue.c:2272
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2418
 kthread+0x3af/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

Crashes (39248):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/11/12 09:39 upstream 3d5e28bff7ad cca87986 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2020/11/03 06:46 net-old 04a55c944f15 cba33199 .config console log report syz C ci-upstream-net-this-kasan-gce
2020/12/05 02:06 bpf-next eceae70bdeae 20366b87 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/12/04 23:15 bpf-next eceae70bdeae 20366b87 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/12/04 21:45 bpf-next eceae70bdeae 20366b87 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/12/03 20:01 bpf-next 97306be45fbe e6b0d314 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/12/03 00:42 bpf-next ba0581749fec 8c9190ef .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/12/01 22:50 bpf-next df5422851559 07bfe8a5 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/12/01 16:25 bpf-next df5422851559 07bfe8a5 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/12/01 14:51 bpf-next df5422851559 07bfe8a5 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/30 19:20 bpf-next bb1b25cab043 78d50c1d .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/30 18:25 bpf-next bb1b25cab043 78d50c1d .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/30 09:56 bpf-next bb1b25cab043 a0092f9d .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/29 07:07 bpf-next bb1b25cab043 a0092f9d .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/29 06:46 bpf-next bb1b25cab043 a0092f9d .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/29 06:24 bpf-next bb1b25cab043 a0092f9d .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/27 14:41 bpf-next 830382e4ccb5 5018c946 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/27 12:17 bpf-next 830382e4ccb5 5018c946 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/26 19:59 bpf-next fb3558127cb6 1d2b823e .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/25 14:10 bpf-next 607c543f939d 1a1f4bd8 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/25 13:51 bpf-next 607c543f939d 1a1f4bd8 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/25 03:17 bpf-next 1c26ac6ab3ce e34b696c .config console log report syz C ci-upstream-bpf-next-kasan-gce
2020/11/20 09:24 upstream 3494d58865ad 0767f13f .config console log report syz ci-upstream-kasan-gce-root
2020/11/20 07:15 upstream 3494d58865ad 0767f13f .config console log report syz ci-upstream-kasan-gce
2020/11/03 06:11 net-old 04a55c944f15 cba33199 .config console log report syz ci-upstream-net-this-kasan-gce
2020/12/05 06:13 bpf-next eceae70bdeae 20366b87 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/05 05:02 bpf-next eceae70bdeae 20366b87 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/05 04:16 bpf-next eceae70bdeae 20366b87 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/05 03:56 bpf-next eceae70bdeae 20366b87 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/05 02:37 bpf-next eceae70bdeae 20366b87 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/04 22:38 bpf-next eceae70bdeae 20366b87 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/04 03:08 bpf-next 97306be45fbe e6b0d314 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/03 22:27 bpf-next 97306be45fbe e6b0d314 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/02 17:44 bpf-next ba0581749fec 8c9190ef .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/01 16:34 bpf-next df5422851559 07bfe8a5 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/01 16:06 bpf-next df5422851559 07bfe8a5 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/01 15:44 bpf-next df5422851559 07bfe8a5 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/12/01 15:11 bpf-next df5422851559 07bfe8a5 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/30 20:30 bpf-next bb1b25cab043 78d50c1d .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/30 11:14 bpf-next bb1b25cab043 a0092f9d .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/30 11:05 bpf-next bb1b25cab043 a0092f9d .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/28 02:26 bpf-next 105c4e75feb4 486f93ef .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/28 01:48 bpf-next 105c4e75feb4 486f93ef .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/27 14:42 bpf-next 830382e4ccb5 5018c946 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/25 16:53 bpf-next 607c543f939d 1a1f4bd8 .config console log report syz ci-upstream-bpf-next-kasan-gce
2020/11/20 12:06 net-next-old 657bc1d10bfc 0767f13f .config console log report syz ci-upstream-net-kasan-gce
2020/11/16 06:50 linux-next 92edc4aef867 1bf9a662 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2020/11/20 09:00 upstream 131ad0b6f529 0767f13f .config console log report info ci-qemu-upstream
2020/11/20 08:34 upstream 131ad0b6f529 0767f13f .config console log report info ci-upstream-kasan-gce-selinux-root
2020/11/20 07:56 upstream 131ad0b6f529 0767f13f .config console log report info ci-upstream-kasan-gce-smack-root
2020/11/20 08:48 upstream 131ad0b6f529 0767f13f .config console log report info ci-upstream-kasan-gce-386
2020/11/20 08:05 upstream 131ad0b6f529 0767f13f .config console log report info ci-qemu-upstream-386
2020/11/20 14:50 bpf 2801a5da5b25 740ff461 .config console log report info ci-upstream-bpf-kasan-gce
2020/11/14 00:15 net-old 4ee18c179e5e e1140d25 .config console log report info ci-upstream-net-this-kasan-gce
2020/11/03 00:12 net-old 04a55c944f15 8bc4594f .config console log report info ci-upstream-net-this-kasan-gce
2020/12/05 09:35 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 09:18 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 08:12 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 07:08 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 05:23 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 03:05 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 01:34 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 01:30 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/05 00:20 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 23:08 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 20:49 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 19:45 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 19:19 bpf-next eceae70bdeae 20366b87 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 02:44 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 01:44 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 01:25 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 00:18 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 23:18 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 21:30 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 20:24 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 19:40 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 18:34 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 18:14 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 17:07 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 16:47 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 15:40 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 14:36 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 13:51 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 12:49 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 11:48 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 11:41 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 10:36 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 08:43 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 07:47 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 06:45 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 05:40 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 04:34 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 03:31 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 03:05 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 02:00 bpf-next 9e83f54f532b 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/03 00:47 bpf-next ba0581749fec 8c9190ef .config console log report info ci-upstream-bpf-next-kasan-gce
* Struck through repros no longer work on HEAD.