diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2015-02-18 13:37:28 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2015-02-18 13:37:28 +0000 |
commit | 8fbda7f00bd2570deacd3bafd85c6e8d06c44e60 (patch) | |
tree | 9439e630d2ff39cd391b762f776983279859a7a2 /sys/kern/kern_descrip.c | |
parent | 117c6e7cf20c07133584b8a301360a484101bc7b (diff) | |
download | src-8fbda7f00bd2570deacd3bafd85c6e8d06c44e60.tar.gz src-8fbda7f00bd2570deacd3bafd85c6e8d06c44e60.zip |
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.
Notes
Notes:
svn path=/head/; revision=278956
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index a84a478e4e9b..42ca1efda41f 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2337,7 +2337,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, 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 fd, cap_rights_t *needrightsp, #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 fd, cap_rights_t *needrightsp, 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_rights_t *rightsp, u_char *maxprotp, */ 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); } |