Subject: Bug in kernfs_mount()?
To: None <tech-kern@NetBSD.org>
From: Matthias Scheler <tron@zhadum.de>
List: tech-kern
Date: 05/26/2004 15:10:43
	Hello,

kernfs_mount() looks like this:

int
kernfs_mount(mp, path, data, ndp, p)
	struct mount *mp;
	const char *path;
	void *data;
	struct nameidata *ndp;
	struct proc *p;
{
	int error = 0;
	struct kernfs_mount *fmp;

[...]
	MALLOC(fmp, struct kernfs_mount *, sizeof(struct kernfs_mount),
	    M_KERNFSMNT, M_WAITOK);
[...]
	mp->mnt_data = fmp;
	mp->mnt_flag |= MNT_LOCAL;
	vfs_getnewfsid(mp);

	error = set_statvfs_info(path, UIO_USERSPACE, "kernfs", UIO_SYSSPACE,
	    mp, p);

	kernfs_get_rrootdev();
	return error;
}

If set_statvfs_info() returns an error the call to VFS_MOUNT() will fail
and "fmp" will be leaked. Is that correct or will VFS_UNMOUNT() called
even if a mount attempt fails?

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/