diff options
author | Steve French <sfrench@us.ibm.com> | 2008-05-06 13:55:32 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-05-06 13:55:32 -0400 |
commit | a815752ac0ffdb910e92958d41d28f4fb28e5296 (patch) | |
tree | a3aa16a282354da0debe8e3a3a7ed8aac6e54001 /fs/dnotify.c | |
parent | 5ade9deaaa3e1f7291467d97b238648e43eae15e (diff) | |
parent | a15306365a16380f3bafee9e181ba01231d4acd7 (diff) |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/dnotify.c')
-rw-r--r-- | fs/dnotify.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/dnotify.c b/fs/dnotify.c index 28d01ed66de0..676073b8dda5 100644 --- a/fs/dnotify.c +++ b/fs/dnotify.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/fdtable.h> | ||
23 | 24 | ||
24 | int dir_notify_enable __read_mostly = 1; | 25 | int dir_notify_enable __read_mostly = 1; |
25 | 26 | ||
@@ -66,6 +67,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) | |||
66 | struct dnotify_struct **prev; | 67 | struct dnotify_struct **prev; |
67 | struct inode *inode; | 68 | struct inode *inode; |
68 | fl_owner_t id = current->files; | 69 | fl_owner_t id = current->files; |
70 | struct file *f; | ||
69 | int error = 0; | 71 | int error = 0; |
70 | 72 | ||
71 | if ((arg & ~DN_MULTISHOT) == 0) { | 73 | if ((arg & ~DN_MULTISHOT) == 0) { |
@@ -92,6 +94,15 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) | |||
92 | prev = &odn->dn_next; | 94 | prev = &odn->dn_next; |
93 | } | 95 | } |
94 | 96 | ||
97 | rcu_read_lock(); | ||
98 | f = fcheck(fd); | ||
99 | rcu_read_unlock(); | ||
100 | /* we'd lost the race with close(), sod off silently */ | ||
101 | /* note that inode->i_lock prevents reordering problems | ||
102 | * between accesses to descriptor table and ->i_dnotify */ | ||
103 | if (f != filp) | ||
104 | goto out_free; | ||
105 | |||
95 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); | 106 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); |
96 | if (error) | 107 | if (error) |
97 | goto out_free; | 108 | goto out_free; |