diff options
author | jhb <jhb@FreeBSD.org> | 2008-11-04 18:53:33 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-11-04 18:53:33 +0000 |
commit | 31cc9ab8d9dc1d4958088e31ef78510acd8e25ae (patch) | |
tree | 58778b10906fa5a6796c8c4de9adc8d6ebafad0b | |
parent | a29fd74e213d86989f6bbcac72ade8476de10744 (diff) | |
download | FreeBSD-src-31cc9ab8d9dc1d4958088e31ef78510acd8e25ae.zip FreeBSD-src-31cc9ab8d9dc1d4958088e31ef78510acd8e25ae.tar.gz |
Don't leak a reference on the /compat/linux vnode everytime
the linprocfs 'mtab' file is read.
MFC after: 1 month
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 37468aa..50f2954 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -318,11 +318,13 @@ linprocfs_domtab(PFS_FILL_ARGS) NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, linux_emul_path, td); flep = NULL; error = namei(&nd); - VFS_UNLOCK_GIANT(NDHASGIANT(&nd)); - if (error != 0 || vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0) - lep = linux_emul_path; - else - lep = dlep; + lep = linux_emul_path; + if (error == 0) { + if (vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0) + lep = dlep; + vrele(nd.ni_vp); + VFS_UNLOCK_GIANT(NDHASGIANT(&nd)); + } lep_len = strlen(lep); mtx_lock(&mountlist_mtx); |