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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux