aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-10-17 03:10:08 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 11:18:45 -0400
commit8da5ff23ce0a84d9845b01e6fe5047e17836bf5a (patch)
treedc711306a3793c91a5df7fc0223738a40ea3fb7c /fs/fuse
parent7762f5a0b709b415fda132258ad37b9f2a1db994 (diff)
[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')
-rw-r--r--fs/fuse/dir.c2
-rw-r--r--fs/fuse/inode.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index a8f65c11aa2c..7ecfe95795cd 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -163,7 +163,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
163 fuse_send_forget(fc, req, outarg.nodeid, 1); 163 fuse_send_forget(fc, req, outarg.nodeid, 1);
164 return 0; 164 return 0;
165 } 165 }
166 spin_lock(&fc->lock);
166 fi->nlookup ++; 167 fi->nlookup ++;
168 spin_unlock(&fc->lock);
167 } 169 }
168 fuse_put_request(fc, req); 170 fuse_put_request(fc, req);
169 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) 171 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT)
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,
195 } 195 }
196 196
197 fi = get_fuse_inode(inode); 197 fi = get_fuse_inode(inode);
198 spin_lock(&fc->lock);
198 fi->nlookup ++; 199 fi->nlookup ++;
200 spin_unlock(&fc->lock);
199 fuse_change_attributes(inode, attr); 201 fuse_change_attributes(inode, attr);
200 return inode; 202 return inode;
201} 203}