Re: [TOMOYO #5 02/18] Add wrapper functions for VFS helper functions.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <hch@...>, <trond.myklebust@...>
Cc: <akpm@...>, <linux-kernel@...>, <linux-security-module@...>
Date: Monday, November 19, 2007 - 9:18 am

Hello.

Christoph Hellwig wrote:
The process's root and cwd vfsmounts are used permanently, but
this last_vfsmount passed via task_struct behaves like temporary variable
pushed on stack memory.
In other words, last_vfsmount becomes NULL when it becomes invalid.

| static inline int vfs_create2(struct inode *dir, struct dentry *dentry,
| 			      int mode, struct nameidata *nd)
| {
| 	int ret;
| 	struct vfsmount *mnt = nd ? nd->path.mnt : NULL;
| 	struct task_struct *task = current;
| 	struct vfsmount *prev_mnt = task->last_vfsmount;
| 	task->last_vfsmount = mntget(mnt);
| 	ret = vfs_create(dir, dentry, mode, nd);
| 	task->last_vfsmount = prev_mnt;
| 	mntput(mnt);
| 	return ret;
| }

I agree that keeping last_vfsmount after it lost it's reference count is bad, but
I don't understand why keeping last_vfsmount while it has it's reference count is bad too.

Regards.

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [TOMOYO #5 02/18] Add wrapper functions for VFS helper f..., Christoph Hellwig, (Mon Nov 19, 8:53 am)
Re: [TOMOYO #5 02/18] Add wrapper functions for VFS helper f..., Tetsuo Handa, (Mon Nov 19, 9:18 am)