Author: mjg
Date: Wed Feb 18 13:37:28 2015
New Revision: 278956
URL: https://svnweb.freebsd.org/changeset/base/278956

Log:
  filedesc: obtain a stable copy of credentials in fget_unlocked
  
  This was broken in r278930.
  
  While here tidy up fget_mmap to use fdp from local var instead of obtaining
  the same pointer from td.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Wed Feb 18 13:07:26 2015        
(r278955)
+++ head/sys/kern/kern_descrip.c        Wed Feb 18 13:37:28 2015        
(r278956)
@@ -2337,7 +2337,7 @@ fget_unlocked(struct filedesc *fdp, int 
        u_int count;
 #ifdef CAPABILITIES
        seq_t seq;
-       cap_rights_t *haverights;
+       cap_rights_t haverights;
        int error;
 #endif
 
@@ -2356,7 +2356,7 @@ fget_unlocked(struct filedesc *fdp, int 
 #ifdef CAPABILITIES
                seq = seq_read(fd_seq(fdt, fd));
                fde = &fdt->fdt_ofiles[fd];
-               haverights = cap_rights_fde(fde);
+               haverights = *cap_rights_fde(fde);
                fp = fde->fde_file;
                if (!seq_consistent(fd_seq(fdt, fd), seq)) {
                        cpu_spinwait();
@@ -2369,7 +2369,7 @@ fget_unlocked(struct filedesc *fdp, int 
                        return (EBADF);
 #ifdef CAPABILITIES
                if (needrightsp != NULL) {
-                       error = cap_check(haverights, needrightsp);
+                       error = cap_check(&haverights, needrightsp);
                        if (error != 0)
                                return (error);
                }
@@ -2505,7 +2505,7 @@ fget_mmap(struct thread *td, int fd, cap
                 */
                if (maxprotp != NULL)
                        *maxprotp = cap_rights_to_vmprot(cap_rights(fdp, fd));
-               if (!fd_modified(td->td_proc->p_fd, fd, seq))
+               if (!fd_modified(fdp, fd, seq))
                        break;
                fdrop(*fpp, td);
        }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to