From: lyl2019@mail.ustc.edu.cn
To: jack@suse.cz, amir73il@gmail.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] fs/notify/mark: A potential use after free in fsnotify_put_mark_wake
Date: Sun, 28 Mar 2021 17:11:43 +0800 (GMT+08:00) [thread overview]
Message-ID: <39095113.1936a.178781a774a.Coremail.lyl2019@mail.ustc.edu.cn> (raw)
Hi,
My static analyzer tool reported a use after free in fsnotify_put_mark_wake
of the file: fs/notify/mark.c.
In fsnotify_put_mark_wake, it calls fsnotify_put_mark(mark). Inside the function
fsnotify_put_mark(), if conn is NULL, it will call fsnotify_final_mark_destroy(mark)
to free mark->group by fsnotify_put_group(group) and return. I also had inspected
the implementation of fsnotify_put_group() and found that there is no cleanup operation
about group->user_waits.
But after fsnotify_put_mark_wake() returned, mark->group is still used by
if (atomic_dec_and_test(&group->user_waits) && group->shutdown) and later.
Is this an issue?
Thanks.
next reply other threads:[~2021-03-28 9:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-28 9:11 lyl2019 [this message]
2021-03-29 13:57 ` [BUG] fs/notify/mark: A potential use after free in fsnotify_put_mark_wake Jan Kara
2021-03-29 14:07 ` lyl2019
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=39095113.1936a.178781a774a.Coremail.lyl2019@mail.ustc.edu.cn \
--to=lyl2019@mail.ustc.edu.cn \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).