From: Greg KH <gregkh@linuxfoundation.org>
To: Sainath Manda <sainathmanda777@gmail.com>
Cc: tj@kernel.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org,
syzbot+f83fa2cf571bd7650422@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] kernfs: fix deadlock in epoll_ctl by waking pollfree
Date: Fri, 17 Jul 2026 16:21:35 +0200 [thread overview]
Message-ID: <2026071721-preseason-bagginess-055e@gregkh> (raw)
In-Reply-To: <20260621104310.18486-1-sainathmanda777@gmail.com>
On Sun, Jun 21, 2026 at 04:13:10PM +0530, Sainath Manda wrote:
> Syzbot reported a task hung in do_epoll_ctl_file(). This is caused by an
> AB-BA lock inversion between epoll's ep->mtx and kernfs node teardown.
>
> Thread A (epoll_ctl) acquires ep->mtx, then attempts to acquire the
> kernfs active reference during vfs_poll().
> Thread B (kernfs_remove) deactivates the node and attempts to unhook
> active epoll monitors, which requires ep->mtx.
>
> This patch fixes the deadlock by utilizing the existing epoll POLLFREE
> path. By calling wake_up_pollfree(&on->poll) before the waitqueue is
> freed, epoll users are notified to detach their wait entries without
> requiring kernfs teardown to acquire ep->mtx.
>
> Reported-by: syzbot+f83fa2cf571bd7650422@syzkaller.appspotmail.com
> Signed-off-by: Sainath Manda <sainathmanda777@gmail.com>
> ---
> fs/kernfs/file.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
What commit id does this fix? And why isn't it for stable kernels too?
thanks,
greg k-h
prev parent reply other threads:[~2026-07-17 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-21 10:43 [PATCH v2] kernfs: fix deadlock in epoll_ctl by waking pollfree Sainath Manda
2026-07-17 14:21 ` Greg KH [this message]
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=2026071721-preseason-bagginess-055e@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=driver-core@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=sainathmanda777@gmail.com \
--cc=syzbot+f83fa2cf571bd7650422@syzkaller.appspotmail.com \
--cc=tj@kernel.org \
/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