r/o bind mount fixes for 2.6.23-mm1
Subsystems (3)
cover r/o bind mount fixes for 2.6.23-mm1
Here are two small patches for 2.6.23-mm1 that fix some issues with the r/o bind mount code. Besides that, I can see that you handle files opened by dentry_open() somewhere. Nevertheless this files are also fput'ed later.
Regards,
Jan
PATCH 1/2 r/o bind mounts: Dont touch the vfsmount after path_put()
mnt_drop_write() is called after releasing the reference to the path with path_put().
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -752,8 +752,8 @@ static struct sock *unix_find_other(struif (u->sk_type == type)touch_atime (nd.path.mnt, nd.path.dentry); -path_put (&nd.path);mnt_drop_write (nd.path.mnt); +path_put (&nd.path); err=-EPROTOTYPE ;if (u->sk_type != type) {
Re: [patch 1/2] r/o bind mounts: Dont touch the vfsmount after path_put()
Quoted 5 lines · Jan Blunck
plain text document attachment (vfs)
mnt_drop_write()is called after releasing the reference to the path withpath_put().Signed-off-by Jan Blunck <[email protected]>
Ugh. Yeah. Thanks for finding that.
-- Dave
PATCH 2/2 r/o bind mounts: Accept passing a mnt NULL pointer to mnt_drop_write()
In reply to Jan BlunckIn case of somebody opens a file with dentry_open(dentry, NULL, ...) we don't want to stumble on the NULL pointer mnt in struct file.
--- fs/namespace.c | 3 +++ 1 file changed, 3 insertions(+)
fs/namespace.c +3 -0
@@ -253,6 +253,9 @@ void mnt_drop_write(struct vfsmount *mntint must_check_underflow =0 ;struct mnt_writer *cpu_writer; +if (!mnt) +return ; + cpu_writer = &get_cpu_var (mnt_writers);spin_lock (&cpu_writer->lock);
Re: [patch 2/2] r/o bind mounts: Accept passing a mnt NULL pointer to mnt_drop_write()
Quoted 2 lines · Jan Blunck
In case of somebody opens a file with
dentry_open(dentry, NULL, ...)we don't want to stumble on the NULL pointer mnt in struct file.
...
fs/namespace.c void mnt_drop_write(struct vfsmount *mnt · line 257
Quoted 7 lines
+++
b/fs/namespace.cfs/namespace.c +2
-0@@ -253,6 +253,9 @@ void mnt_drop_write(struct vfsmount *mntint must_check_underflow =0 ;struct mnt_writer *cpu_writer; +if (!mnt) +return ;
I kinda wish we'd fix these in the callers. I know we do something similar to this with mntput(), but I worry a bit that this just discourages people from using the right interfaces.
Do you have a case where we're actually getting a NULL mount in here? We had at least one in reiser4 that really revealed some nastiness in the fs that needed fixing.
-- Dave
Re: [patch 2/2] r/o bind mounts: Accept passing a mnt NULL pointer to mnt_drop_write()
In reply to Jan BlunckQuoted 2 lines · Jan Blunck
In case of somebody opens a file with
dentry_open(dentry, NULL, ...)we don't want to stumble on the NULL pointer mnt in struct file.
We should just not allow a NULL vfsmount in dentry_open. Dave and I have fixes for reiserfs, and I'll look at the uml use.