From: Greg KH <gregkh@linuxfoundation.org>
To: Wxm-233 <lty2wxm@gmail.com>
Cc: johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
brauner@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [BUG] mac80211: lockdep warning from key debugfs creation
Date: Sun, 19 Apr 2026 08:48:01 +0200 [thread overview]
Message-ID: <2026041944-dallying-unsettled-6e38@gregkh> (raw)
In-Reply-To: <20260417171253.662-1-2200013188@stu.pku.edu.cn>
On Sat, Apr 18, 2026 at 01:12:53AM +0800, Wxm-233 wrote:
> Hello,
>
> We hit a lockdep warning in the mac80211 key-add path under
> syzkaller-style workloads.
>
> We reproduced this on 6.19.0-rc5-00042-g944aacb68baf. In the same bug
> bucket, later runs still show the same warning on
> 7.0.0-rc2-g0031c06807cf.
>
> The warning is:
>
> WARNING: possible circular locking dependency detected
>
> The observed path is:
>
> nl80211_new_key()
> -> rdev_add_key()
> -> ieee80211_add_key()
> -> ieee80211_key_link()
> -> ieee80211_debugfs_key_add()
> -> debugfs_create_dir()
> -> start_dirop()
>
> nl80211_pre_doit() keeps wiphy.mtx held across nl80211_new_key().
> After ieee80211_key_replace() succeeds, ieee80211_key_link()
> immediately creates per-key debugfs entries.
>
> That debugfs_create_dir() call goes through debugfs_start_creating(),
> simple_start_creating(), and start_dirop(). start_dirop() takes the
> parent inode rwsem and lookup_one_qstr_excl() then allocates a dentry
> with GFP_KERNEL, which introduces fs_reclaim into the lock chain.
>
> The warning becomes possible because there is already an existing
> dependency from relay_open_buf()/relay_create_buf_file(): that path
> holds relay_channels_mutex and then enters the same debugfs/VFS
> creation flow, which reaches the directory inode lock.
>
> With both chains present, lockdep reports the cycle:
>
> fs_reclaim -> relay_channels_mutex -> inode rwsem -> fs_reclaim
>
> This looks more like a real locking problem than a pure fuzzing
> artifact. The trigger is a syzkaller-style key creation workload, but
> the questionable part is that mac80211 performs non-essential debugfs
> creation inside the locked key installation path.
>
> A possible fix direction would be to avoid creating per-key debugfs
> entries while still in the locked add-key path, for example by
> deferring the debugfs population until after the critical section or by
> moving it to a safer asynchronous context.
>
> Relevant source locations in current trees are:
>
> net/wireless/nl80211.c: nl80211_pre_doit(), nl80211_new_key()
> net/mac80211/key.c: ieee80211_key_link()
> net/mac80211/debugfs_key.c: ieee80211_debugfs_key_add()
> fs/namei.c: start_dirop()
>
> If useful, I can also send the full report/log pair.
Why not send a fix for this so you get full credit for it?
thanks,
greg k-h
next prev parent reply other threads:[~2026-04-19 6:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 17:12 [BUG] mac80211: lockdep warning from key debugfs creation Wxm-233
2026-04-19 6:48 ` Greg KH [this message]
2026-04-20 6:54 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026041944-dallying-unsettled-6e38@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=brauner@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lty2wxm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox