Author: mjg Date: Fri Sep 23 06:51:46 2016 New Revision: 306226 URL: https://svnweb.freebsd.org/changeset/base/306226
Log: fd: fix up fgetvp_rights after r306184 fget_cap_locked returns a referenced file, but the fgetvp_rights does not need it. Instead, due to the filedesc lock being held, it can ref the vnode after the file was looked up. Fix up fget_cap_locked to be consistent with other _locked helpers and not ref the file. This plugs a leak introduced in r306184. Pointy hat to: mjg, oshogbo Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Sep 23 04:53:47 2016 (r306225) +++ head/sys/kern/kern_descrip.c Fri Sep 23 06:51:46 2016 (r306226) @@ -2469,7 +2469,6 @@ fget_cap_locked(struct filedesc *fdp, in if (havecapsp != NULL) filecaps_copy(&fde->fde_caps, havecapsp, true); - fhold(fde->fde_file); *fpp = fde->fde_file; error = 0; @@ -2511,6 +2510,8 @@ fget_cap(struct thread *td, int fd, cap_ get_locked: FILEDESC_SLOCK(fdp); error = fget_cap_locked(fdp, fd, needrightsp, fpp, havecapsp); + if (error == 0) + fhold(*fpp); FILEDESC_SUNLOCK(fdp); return (error); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"