[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1Jh7H4-0006Uc-7q@pomaz-ex.szeredi.hu>
Date: Wed, 02 Apr 2008 20:01:26 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: haveblue@...ibm.com
CC: viro@...IV.linux.org.uk, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [patch] vfs: ro-bind: fix leaking refcounts in setxattr
From: Miklos Szeredi <mszeredi@...e.cz>
setxattr() and lsetxattr() were leaking mount/dentry references on
read-only mount.
Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
---
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists