summaryrefslogtreecommitdiff
blob: ab637bc46fd2cf1f21766eb7cab5b06d64abbe38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff -urpN linux-source-2.6.18.orig/fs/dnotify.c linux-source-2.6.18/fs/dnotify.c
--- linux-source-2.6.18.orig/fs/dnotify.c	2006-09-19 21:42:06.000000000 -0600
+++ linux-source-2.6.18/fs/dnotify.c	2008-04-09 13:50:42.000000000 -0600
@@ -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;
 
@@ -92,6 +93,10 @@ int fcntl_dirnotify(int fd, struct file 
 		prev = &odn->dn_next;
 	}
 
+	/* we'd lost the race with close(), sod off silently */
+	if (fcheck(fd) != filp)
+		goto out_free;
+
 	error = f_setown(filp, current->pid, 0);
 	if (error)
 		goto out_free;