summaryrefslogtreecommitdiffstats
path: root/fs/fuse/inode.c
diff options
context:
space:
mode:
authorMiklos Szeredi2006-10-17 09:10:08 +0200
committerLinus Torvalds2006-10-17 17:18:45 +0200
commit8da5ff23ce0a84d9845b01e6fe5047e17836bf5a (patch)
treedc711306a3793c91a5df7fc0223738a40ea3fb7c /fs/fuse/inode.c
parent[PATCH] document i_size_write locking rules (diff)
downloadkernel-qcow2-linux-8da5ff23ce0a84d9845b01e6fe5047e17836bf5a.tar.gz
kernel-qcow2-linux-8da5ff23ce0a84d9845b01e6fe5047e17836bf5a.tar.xz
kernel-qcow2-linux-8da5ff23ce0a84d9845b01e6fe5047e17836bf5a.zip
[PATCH] fuse: locking fix for nlookup
An inode could be returned by independent parallel lookups, in this case an update of the lookup counter could be lost resulting in a memory leak in userspace. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r--fs/fuse/inode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 8e106163aaed..e9114237f31f 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -195,7 +195,9 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
}
fi = get_fuse_inode(inode);
+ spin_lock(&fc->lock);
fi->nlookup ++;
+ spin_unlock(&fc->lock);
fuse_change_attributes(inode, attr);
return inode;
}