From: Steven Whitehouse <swhiteho@redhat.com>
To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 6/6] GFS2: Fix unsafe dereference in dump_holder()
Date: Thu, 2 Jan 2014 12:28:14 +0000 [thread overview]
Message-ID: <1388665694-1639-7-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1388665694-1639-1-git-send-email-swhiteho@redhat.com>
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
GLOCK_BUG_ON() might call this function without RCU read lock. Make sure that
RCU read lock is held when using task_struct returned from pid_task().
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index c8420f7..6f7a47c 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1655,6 +1655,7 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
struct task_struct *gh_owner = NULL;
char flags_buf[32];
+ rcu_read_lock();
if (gh->gh_owner_pid)
gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID);
gfs2_print_dbg(seq, " H: s:%s f:%s e:%d p:%ld [%s] %pS\n",
@@ -1664,6 +1665,7 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
gh->gh_owner_pid ? (long)pid_nr(gh->gh_owner_pid) : -1,
gh_owner ? gh_owner->comm : "(ended)",
(void *)gh->gh_ip);
+ rcu_read_unlock();
return 0;
}
--
1.8.3.1
prev parent reply other threads:[~2014-01-02 12:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 12:28 GFS2: Pre-pull patch posting (fixes) Steven Whitehouse
2014-01-02 12:28 ` [PATCH 1/6] GFS2: don't hold s_umount over blkdev_put Steven Whitehouse
2014-01-02 12:28 ` [PATCH 2/6] GFS2: Fix use-after-free race when calling gfs2_remove_from_ail Steven Whitehouse
2014-01-02 12:28 ` [PATCH 3/6] GFS2: Fix slab memory leak in gfs2_bufdata Steven Whitehouse
2014-01-02 12:28 ` [PATCH 4/6] GFS2: Fix incorrect invalidation for DIO/buffered I/O Steven Whitehouse
2014-01-02 12:28 ` [PATCH 5/6] GFS2: Wait for async DIO in glock state changes Steven Whitehouse
2014-01-02 12:28 ` Steven Whitehouse [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=1388665694-1639-7-git-send-email-swhiteho@redhat.com \
--to=swhiteho@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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).