diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-10-02 05:17:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:15 -0400 |
commit | 43fa1adb9334bf4585cd53144eb5911488f85bc7 (patch) | |
tree | 64be64424e7db15e1872077f900870895ccac85b /fs | |
parent | a03fcb730b4fe7da14ca4405f23dbde717b1d2b9 (diff) |
[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@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fcntl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c index e7c66a1bf831..e4f26165f12a 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -305,9 +305,11 @@ void f_delown(struct file *filp) | |||
305 | pid_t f_getown(struct file *filp) | 305 | pid_t f_getown(struct file *filp) |
306 | { | 306 | { |
307 | pid_t pid; | 307 | pid_t pid; |
308 | read_lock(&filp->f_owner.lock); | ||
308 | pid = pid_nr(filp->f_owner.pid); | 309 | pid = pid_nr(filp->f_owner.pid); |
309 | if (filp->f_owner.pid_type == PIDTYPE_PGID) | 310 | if (filp->f_owner.pid_type == PIDTYPE_PGID) |
310 | pid = -pid; | 311 | pid = -pid; |
312 | read_unlock(&filp->f_owner.lock); | ||
311 | return pid; | 313 | return pid; |
312 | } | 314 | } |
313 | 315 | ||