diff options
author | dfr <dfr@FreeBSD.org> | 2008-07-24 13:42:28 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2008-07-24 13:42:28 +0000 |
commit | 1c54b514dd964daa1a20150867856a0b2b5f2cc1 (patch) | |
tree | 98017e0a5482c623f6b9770c1764ca68fb06202d /sys/nfsclient | |
parent | 49ad2adb91673def2dfa0f293612e2de5e3a29af (diff) | |
download | FreeBSD-src-1c54b514dd964daa1a20150867856a0b2b5f2cc1.zip FreeBSD-src-1c54b514dd964daa1a20150867856a0b2b5f2cc1.tar.gz |
Don't use a userspace pointer in the kernel when trying to record the hostname
which we need for NLM requests.
PR: 125849
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 85b8503..eb64d3c 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -105,7 +105,7 @@ SYSCTL_INT(_vfs_nfs, NFS_TPRINTF_DELAY, downdelayinterval, CTLFLAG_RW, &nfs_tprintf_delay, 0, ""); static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, - struct nfs_args *argp); + struct nfs_args *argp, const char *hostname); static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, struct ucred *cred); @@ -540,7 +540,8 @@ nfs_mountdiskless(char *path, } static void -nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp) +nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, + const char *hostname) { int s; int adjsock; @@ -706,10 +707,13 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp) } } - strlcpy(nmp->nm_hostname, argp->hostname, sizeof(nmp->nm_hostname)); - p = strchr(nmp->nm_hostname, ':'); - if (p) - *p = '\0'; + if (hostname) { + strlcpy(nmp->nm_hostname, argp->hostname, + sizeof(nmp->nm_hostname)); + p = strchr(nmp->nm_hostname, ':'); + if (p) + *p = '\0'; + } } static const char *nfs_opts[] = { "from", "nfs_args", @@ -799,7 +803,7 @@ nfs_mount(struct mount *mp, struct thread *td) ~(NFSMNT_NFSV3 | NFSMNT_NOLOCKD /*|NFSMNT_XLATECOOKIE*/)) | (nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NOLOCKD /*|NFSMNT_XLATECOOKIE*/)); - nfs_decode_args(mp, nmp, &args); + nfs_decode_args(mp, nmp, &args, NULL); goto out; } @@ -937,7 +941,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, nmp->nm_soproto = argp->proto; nmp->nm_rpcops = &nfs_rpcops; - nfs_decode_args(mp, nmp, argp); + nfs_decode_args(mp, nmp, argp, hst); /* * For Connection based sockets (TCP,...) defer the connect until |