Message ID | 20171120225757.96498-1-ebiggers3@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Eric Biggers <ebiggers3@gmail.com> wrote:
> - construct_get_dest_keyring(&dest_keyring);
This will break. construct_get_dest_keyring() does other things than just
getting a ref on whatever dest_keyring points to.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Nov 24, 2017 at 03:52:05PM +0000, David Howells wrote: > Eric Biggers <ebiggers3@gmail.com> wrote: > > > - construct_get_dest_keyring(&dest_keyring); > > This will break. construct_get_dest_keyring() does other things than just > getting a ref on whatever dest_keyring points to. > Not if dest_keyring is non-NULL (i.e. explicitly specified), which it is in this case. Eric -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Eric Biggers <ebiggers3@gmail.com> wrote: > > > - construct_get_dest_keyring(&dest_keyring); > > > > This will break. construct_get_dest_keyring() does other things than just > > getting a ref on whatever dest_keyring points to. > > > > Not if dest_keyring is non-NULL (i.e. explicitly specified), which it is in > this case. Actually, you're right. David -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Eric Biggers <ebiggers3@gmail.com> wrote: > if (dest_keyring) { > - construct_get_dest_keyring(&dest_keyring); Actually, I think I have the order of these lines inverted. construct_get_dest_keyring() can actually return without setting dest_keyring to anything. This didn't used to be the case, but now that the user-session keyring is made lazily, there's no guaranteed fallback. David -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index e8036cd0ad54..c6880af8b411 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c @@ -546,9 +546,7 @@ struct key *request_key_and_link(struct key_type *type, if (!IS_ERR(key_ref)) { key = key_ref_to_ptr(key_ref); if (dest_keyring) { - construct_get_dest_keyring(&dest_keyring); ret = key_link(dest_keyring, key); - key_put(dest_keyring); if (ret < 0) { key_put(key); key = ERR_PTR(ret);