+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)?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to