Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95635
b: refs/heads/master
c: 214b704
h: refs/heads/master
i:
  95633: bbed324
  95631: 98dd820
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed May 1, 2008
1 parent d671f97 commit 0da740b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d98ca736441029e4e87ad3b6dc4a8645dc4c6d3
refs/heads/master: 214b7049a7929f03bbd2786aaef04b8b79db34e2
11 changes: 11 additions & 0 deletions trunk/fs/dnotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/file.h>

int dir_notify_enable __read_mostly = 1;

Expand Down Expand Up @@ -66,6 +67,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
struct dnotify_struct **prev;
struct inode *inode;
fl_owner_t id = current->files;
struct file *f;
int error = 0;

if ((arg & ~DN_MULTISHOT) == 0) {
Expand All @@ -92,6 +94,15 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
prev = &odn->dn_next;
}

rcu_read_lock();
f = fcheck(fd);
rcu_read_unlock();
/* we'd lost the race with close(), sod off silently */
/* note that inode->i_lock prevents reordering problems
* between accesses to descriptor table and ->i_dnotify */
if (f != filp)
goto out_free;

error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);
if (error)
goto out_free;
Expand Down

0 comments on commit 0da740b

Please sign in to comment.