[<prev] [next>] [day] [month] [year] [list]
Message-ID: <m1r6ykfjix.fsf@ebiederm.dsl.xmission.com>
Date: Sat, 09 Sep 2006 22:11:18 -0600
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Andrew Morton <akpm@...l.org>
Cc: <linux-kernel@...r.kernel.org>,
Linux Containers <containers@...ts.osdl.org>,
Oleg Nesterov <oleg@...sign.ru>
Subject: [PATCH] file: Add locking to f_getown
This has been needed for a long time, but now with the advent
of a reference counted struct pid there are real consequences
for getting this wrong.
Someone I think it was Oleg Nesterov pointed out that this construct
was missing locking, when I introduced struct pid. After taking time
to review the locking construct already present I figured out which
lock needs to be taken. The other paths that access f_owner.pid
take either the f_owner read or the write lock.
Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>
---
fs/fcntl.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 821ebb9..b1dd4d4 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -305,9 +305,11 @@ void f_delown(struct file *filp)
pid_t f_getown(struct file *filp)
{
pid_t pid;
+ read_lock(&filp->f_owner.lock);
pid = pid_nr(filp->f_owner.pid);
if (filp->f_owner.pid_type == PIDTYPE_PGID)
pid = -pid;
+ read_unlock(&filp->f_owner.lock);
return pid;
}
--
1.4.2.rc3.g7e18e-dirty
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists