KEYCTL_SESSION_TO_PARENT wants the effective uid and gid of the caller to be all three of the uids and gids of its parent. Use the library. No functional change. Signed-off-by: Josef Bacik --- security/keys/keyctl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 36ffba0ebba6..cf963251a87a 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -1692,12 +1692,7 @@ long keyctl_session_to_parent(void) /* the parent must have the same effective ownership and mustn't be * SUID/SGID */ - if (!uid_eq(pcred->uid, mycred->euid) || - !uid_eq(pcred->euid, mycred->euid) || - !uid_eq(pcred->suid, mycred->euid) || - !gid_eq(pcred->gid, mycred->egid) || - !gid_eq(pcred->egid, mycred->egid) || - !gid_eq(pcred->sgid, mycred->egid)) + if (!cred_ids_allow_control(mycred, CRED_IDS_EFFECTIVE, pcred)) goto unlock; /* the keyrings must have the same UID */ -- 2.55.0