From: Yahu Gao <yahu.gao@windriver.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
yahu.gao@windriver.com
Subject: [PATCH] fs/proc: Fix NULL pointer dereference in pid_delete_dentry
Date: Wed, 9 Dec 2020 19:21:00 +0800 [thread overview]
Message-ID: <20201209112100.47653-2-yahu.gao@windriver.com> (raw)
In-Reply-To: <20201209112100.47653-1-yahu.gao@windriver.com>
Get the staus of task from the pointer of proc inode directly is not
safe. The function get_proc_task make it happen in RCU protection.
Signed-off-by: Yahu Gao <yahu.gao@windriver.com>
---
fs/proc/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 1bc9bcdef09f..05f33bb35067 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1994,7 +1994,7 @@ static int pid_revalidate(struct dentry *dentry, unsigned int flags)
static inline bool proc_inode_is_dead(struct inode *inode)
{
- return !proc_pid(inode)->tasks[PIDTYPE_PID].first;
+ return !get_proc_task(inode);
}
int pid_delete_dentry(const struct dentry *dentry)
--
2.25.1
next prev parent reply other threads:[~2020-12-09 11:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 11:20 Review request 0/1: fs/proc: Fix NULL pointer dereference in Yahu Gao
2020-12-09 11:21 ` Yahu Gao [this message]
2020-12-09 13:16 ` [PATCH] fs/proc: Fix NULL pointer dereference in pid_delete_dentry Al Viro
2021-01-07 9:41 ` [PATCH v2] " Gao Yahu
2020-12-09 21:54 ` Review request 0/1: fs/proc: Fix NULL pointer dereference in Eric W. Biederman
2021-01-07 9:02 ` Gao Yahu
2021-01-07 9:03 ` Gao, Yahu
2021-01-07 9:07 ` Gao Yahu
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=20201209112100.47653-2-yahu.gao@windriver.com \
--to=yahu.gao@windriver.com \
--cc=adobriyan@gmail.com \
--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).