[patch] vfs: ro-bind: fix leaking refcounts in setxattr

From: Miklos Szeredi
Date: Wed Apr 02 2008 - 14:01:48 EST


From: Miklos Szeredi <mszeredi@xxxxxxx>

setxattr() and lsetxattr() were leaking mount/dentry references on
read-only mount.

Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
---
fs/xattr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Index: vfs-2.6/fs/xattr.c
===================================================================
--- vfs-2.6.orig/fs/xattr.c 2008-04-02 19:53:18.000000000 +0200
+++ vfs-2.6/fs/xattr.c 2008-04-02 19:54:53.000000000 +0200
@@ -263,9 +263,10 @@ sys_setxattr(char __user *path, char __u
return error;
error = mnt_want_write(nd.path.mnt);
if (error)
- return error;
+ goto out_path_put;
error = setxattr(nd.path.dentry, name, value, size, flags);
mnt_drop_write(nd.path.mnt);
+ out_path_put:
path_put(&nd.path);
return error;
}
@@ -282,9 +283,10 @@ sys_lsetxattr(char __user *path, char __
return error;
error = mnt_want_write(nd.path.mnt);
if (error)
- return error;
+ goto out_path_put;
error = setxattr(nd.path.dentry, name, value, size, flags);
mnt_drop_write(nd.path.mnt);
+ out_path_put:
path_put(&nd.path);
return error;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/