[gamin] Re: [ANNOUNCE] inotify 0.18
- From: Al Viro <viro parcelfarce linux theplanet co uk>
- To: John McCutchan <ttb tentacle dhs org>
- Cc: akpm osdl org, gamin-list gnome org, bkonrath redhat com, greg kroah com, rml novell com, linux-kernel vger kernel org
- Subject: [gamin] Re: [ANNOUNCE] inotify 0.18
- Date: Tue, 25 Jan 2005 20:01:01 +0000
+static struct inode * find_inode(const char __user *dirname)
+{
+ struct inode *inode;
+ struct nameidata nd;
+ int error;
+
+ error = __user_walk(dirname, LOOKUP_FOLLOW, &nd);
+ if (error)
+ return ERR_PTR(error);
+
+ inode = nd.dentry->d_inode;
+
+ /* you can only watch an inode if you have read permissions on it */
+ error = permission(inode, MAY_READ, NULL);
+ if (error) {
+ inode = ERR_PTR(error);
+ goto release_and_out;
+ }
+
+ spin_lock(&inode_lock);
+ __iget(inode);
+ spin_unlock(&inode_lock);
+release_and_out:
+ path_release(&nd);
+ return inode;
+}
Yawn... OK, so what happens if we get umount in the middle of your
find_inode(), so that path_release() in there drops the last remaining
reference to vfsmount (and superblock)?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]