]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - security/keys/keyctl.c
KEYS: Fix bug in keyctl_session_to_parent() if parent has no session keyring
[net-next-2.6.git] / security / keys / keyctl.c
index 3868c6700b588512acc36814682f895644116089..60924f6a52db2bbff40ddc953a50bb9d708febb5 100644 (file)
@@ -1305,7 +1305,8 @@ long keyctl_session_to_parent(void)
                goto not_permitted;
 
        /* the keyrings must have the same UID */
-       if (pcred->tgcred->session_keyring->uid != mycred->euid ||
+       if ((pcred->tgcred->session_keyring &&
+            pcred->tgcred->session_keyring->uid != mycred->euid) ||
            mycred->tgcred->session_keyring->uid != mycred->euid)
                goto not_permitted;