When reading pr_securelevel from a prison, perform a lockless read,
as it's an integer read operation and the resulting slight race is acceptable. MFC after: 1 week
This commit is contained in:
parent
293a12c083
commit
1d8015ceb7
@ -1276,10 +1276,8 @@ securelevel_gt(struct ucred *cr, int level)
|
||||
active_securelevel = securelevel;
|
||||
KASSERT(cr != NULL, ("securelevel_gt: null cr"));
|
||||
if (cr->cr_prison != NULL) {
|
||||
mtx_lock(&cr->cr_prison->pr_mtx);
|
||||
active_securelevel = imax(cr->cr_prison->pr_securelevel,
|
||||
active_securelevel);
|
||||
mtx_unlock(&cr->cr_prison->pr_mtx);
|
||||
}
|
||||
return (active_securelevel > level ? EPERM : 0);
|
||||
}
|
||||
@ -1292,10 +1290,8 @@ securelevel_ge(struct ucred *cr, int level)
|
||||
active_securelevel = securelevel;
|
||||
KASSERT(cr != NULL, ("securelevel_ge: null cr"));
|
||||
if (cr->cr_prison != NULL) {
|
||||
mtx_lock(&cr->cr_prison->pr_mtx);
|
||||
active_securelevel = imax(cr->cr_prison->pr_securelevel,
|
||||
active_securelevel);
|
||||
mtx_unlock(&cr->cr_prison->pr_mtx);
|
||||
}
|
||||
return (active_securelevel >= level ? EPERM : 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user