diff
 static int __key_instantiate_and_link(struct key *key,
 				      struct key_preparsed_payload *prep,
 				      struct key *keyring,
 				      struct key *authkey,
 				      struct assoc_array_edit **_edit)
 {
 	int ret, awaken;
+
+	if (!prep)
+		return -EINVAL;
 
 	key_check(key);
 	key_check(keyring);
