diff options
author | kib <kib@FreeBSD.org> | 2015-02-24 13:07:31 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-02-24 13:07:31 +0000 |
commit | c3462c63fb60ce2f8eefcd94a5e34c147081739e (patch) | |
tree | 3199407ed932a7a9788fc67d89de74186268307a | |
parent | 6cc0e8d2a0b583db5707f811d4ebfbe1ad05e628 (diff) | |
download | FreeBSD-src-c3462c63fb60ce2f8eefcd94a5e34c147081739e.zip FreeBSD-src-c3462c63fb60ce2f8eefcd94a5e34c147081739e.tar.gz |
Keep a reference on the coredump vnode for vn_fullpath() call. Do it
by moving vn_close() after the point where notification is sent.
Reported by: sbruno
Tested by: pho, sbruno
Sponsored by: The FreeBSD Foundation
-rw-r--r-- | sys/kern/kern_sig.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 41da3dd..57f66b0 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3310,7 +3310,7 @@ coredump(struct thread *td) vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0) { VOP_UNLOCK(vp, 0); error = EFAULT; - goto close; + goto out; } VOP_UNLOCK(vp, 0); @@ -3347,17 +3347,12 @@ coredump(struct thread *td) VOP_ADVLOCK(vp, (caddr_t)p, F_UNLCK, &lf, F_FLOCK); } vn_rangelock_unlock(vp, rl_cookie); -close: - error1 = vn_close(vp, FWRITE, cred, td); - if (error == 0) - error = error1; - else - goto out; + /* * Notify the userland helper that a process triggered a core dump. * This allows the helper to run an automated debugging session. */ - if (coredump_devctl == 0) + if (error != 0 || coredump_devctl == 0) goto out; len = MAXPATHLEN * 2 + sizeof(comm_name) - 1 + sizeof(' ') + sizeof(core_name) - 1; @@ -3377,6 +3372,9 @@ close: strlcat(data, fullpath, len); devctl_notify("kernel", "signal", "coredump", data); out: + error1 = vn_close(vp, FWRITE, cred, td); + if (error == 0) + error = error1; #ifdef AUDIT audit_proc_coredump(td, name, error); #endif |