提交 8da5ff23 编写于 作者: M Miklos Szeredi 提交者: Linus Torvalds

[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: NMiklos Szeredi <miklos@szeredi.hu>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 7762f5a0
...@@ -163,7 +163,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) ...@@ -163,7 +163,9 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
fuse_send_forget(fc, req, outarg.nodeid, 1); fuse_send_forget(fc, req, outarg.nodeid, 1);
return 0; return 0;
} }
spin_lock(&fc->lock);
fi->nlookup ++; fi->nlookup ++;
spin_unlock(&fc->lock);
} }
fuse_put_request(fc, req); fuse_put_request(fc, req);
if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT)
......
...@@ -195,7 +195,9 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, ...@@ -195,7 +195,9 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
} }
fi = get_fuse_inode(inode); fi = get_fuse_inode(inode);
spin_lock(&fc->lock);
fi->nlookup ++; fi->nlookup ++;
spin_unlock(&fc->lock);
fuse_change_attributes(inode, attr); fuse_change_attributes(inode, attr);
return inode; return inode;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册