summaryrefslogtreecommitdiffstats
path: root/fs/affs/namei.c
diff options
context:
space:
mode:
authorAl Viro2010-01-24 06:04:07 +0100
committerAl Viro2010-01-27 04:22:24 +0100
commit29333920a5a46edcc9b728e2cf0134d5a9b516ee (patch)
tree2991b9f6d82d43c712278d6364da4faad4a0180d /fs/affs/namei.c
parentFix a leak in affs_fill_super() (diff)
downloadkernel-qcow2-linux-29333920a5a46edcc9b728e2cf0134d5a9b516ee.tar.gz
kernel-qcow2-linux-29333920a5a46edcc9b728e2cf0134d5a9b516ee.tar.xz
kernel-qcow2-linux-29333920a5a46edcc9b728e2cf0134d5a9b516ee.zip
Fix remount races with symlink handling in affs
A couple of fields in affs_sb_info is used in follow_link() and symlink() for handling AFFS "absolute" symlinks. Need locking against affs_remount() updates. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/affs/namei.c')
-rw-r--r--fs/affs/namei.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 960d336ec694..d70bbbac6b7b 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -341,10 +341,13 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
p = (char *)AFFS_HEAD(bh)->table;
lc = '/';
if (*symname == '/') {
+ struct affs_sb_info *sbi = AFFS_SB(sb);
while (*symname == '/')
symname++;
- while (AFFS_SB(sb)->s_volume[i]) /* Cannot overflow */
- *p++ = AFFS_SB(sb)->s_volume[i++];
+ spin_lock(&sbi->symlink_lock);
+ while (sbi->s_volume[i]) /* Cannot overflow */
+ *p++ = sbi->s_volume[i++];
+ spin_unlock(&sbi->symlink_lock);
}
while (i < maxlen && (c = *symname++)) {
if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') {