Date: Fri, 23 Sep 2016 08:13:46 +0000 (UTC) From: Mariusz Zaborski <oshogbo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306232 - head/sys/kern Message-ID: <201609230813.u8N8DkjF045712@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oshogbo Date: Fri Sep 23 08:13:46 2016 New Revision: 306232 URL: https://svnweb.freebsd.org/changeset/base/306232 Log: fd: fix up fget_cap If the kernel is not compiled with the CAPABILITIES kernel options fget_unlocked doesn't return the sequence number so fd_modify will always report modification, in that case we got infinity loop. Reported by: br Reviewed by: mjg Tested by: br, def Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Sep 23 07:51:01 2016 (r306231) +++ head/sys/kern/kern_descrip.c Fri Sep 23 08:13:46 2016 (r306232) @@ -2480,12 +2480,16 @@ int fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp, struct file **fpp, struct filecaps *havecapsp) { - struct filedesc *fdp; - struct file *fp; + struct filedesc *fdp = td->td_proc->p_fd; int error; +#ifndef CAPABILITIES + error = fget_unlocked(fdp, fd, needrightsp, fpp, NULL); + if (error == 0 && havecapsp != NULL) + filecaps_fill(havecapsp); +#else + struct file *fp; seq_t seq; - fdp = td->td_proc->p_fd; for (;;) { error = fget_unlocked(fdp, fd, needrightsp, &fp, &seq); if (error != 0) @@ -2513,7 +2517,7 @@ get_locked: if (error == 0) fhold(*fpp); FILEDESC_SUNLOCK(fdp); - +#endif return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609230813.u8N8DkjF045712>