@@ -409,7 +409,7 @@ static int __key_instantiate_and_link(struct key *key,
409409 struct key_preparsed_payload * prep ,
410410 struct key * keyring ,
411411 struct key * authkey ,
412- unsigned long * _prealloc )
412+ struct assoc_array_edit * * _edit )
413413{
414414 int ret , awaken ;
415415
@@ -436,7 +436,7 @@ static int __key_instantiate_and_link(struct key *key,
436436
437437 /* and link it into the destination keyring */
438438 if (keyring )
439- __key_link (keyring , key , _prealloc );
439+ __key_link (key , _edit );
440440
441441 /* disable the authorisation key */
442442 if (authkey )
@@ -476,7 +476,7 @@ int key_instantiate_and_link(struct key *key,
476476 struct key * authkey )
477477{
478478 struct key_preparsed_payload prep ;
479- unsigned long prealloc ;
479+ struct assoc_array_edit * edit ;
480480 int ret ;
481481
482482 memset (& prep , 0 , sizeof (prep ));
@@ -490,16 +490,15 @@ int key_instantiate_and_link(struct key *key,
490490 }
491491
492492 if (keyring ) {
493- ret = __key_link_begin (keyring , & key -> index_key , & prealloc );
493+ ret = __key_link_begin (keyring , & key -> index_key , & edit );
494494 if (ret < 0 )
495495 goto error_free_preparse ;
496496 }
497497
498- ret = __key_instantiate_and_link (key , & prep , keyring , authkey ,
499- & prealloc );
498+ ret = __key_instantiate_and_link (key , & prep , keyring , authkey , & edit );
500499
501500 if (keyring )
502- __key_link_end (keyring , & key -> index_key , prealloc );
501+ __key_link_end (keyring , & key -> index_key , edit );
503502
504503error_free_preparse :
505504 if (key -> type -> preparse )
@@ -537,7 +536,7 @@ int key_reject_and_link(struct key *key,
537536 struct key * keyring ,
538537 struct key * authkey )
539538{
540- unsigned long prealloc ;
539+ struct assoc_array_edit * edit ;
541540 struct timespec now ;
542541 int ret , awaken , link_ret = 0 ;
543542
@@ -548,7 +547,7 @@ int key_reject_and_link(struct key *key,
548547 ret = - EBUSY ;
549548
550549 if (keyring )
551- link_ret = __key_link_begin (keyring , & key -> index_key , & prealloc );
550+ link_ret = __key_link_begin (keyring , & key -> index_key , & edit );
552551
553552 mutex_lock (& key_construction_mutex );
554553
@@ -570,7 +569,7 @@ int key_reject_and_link(struct key *key,
570569
571570 /* and link it into the destination keyring */
572571 if (keyring && link_ret == 0 )
573- __key_link (keyring , key , & prealloc );
572+ __key_link (key , & edit );
574573
575574 /* disable the authorisation key */
576575 if (authkey )
@@ -580,7 +579,7 @@ int key_reject_and_link(struct key *key,
580579 mutex_unlock (& key_construction_mutex );
581580
582581 if (keyring )
583- __key_link_end (keyring , & key -> index_key , prealloc );
582+ __key_link_end (keyring , & key -> index_key , edit );
584583
585584 /* wake up anyone waiting for a key to be constructed */
586585 if (awaken )
@@ -783,8 +782,8 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
783782 .description = description ,
784783 };
785784 struct key_preparsed_payload prep ;
785+ struct assoc_array_edit * edit ;
786786 const struct cred * cred = current_cred ();
787- unsigned long prealloc ;
788787 struct key * keyring , * key = NULL ;
789788 key_ref_t key_ref ;
790789 int ret ;
@@ -828,7 +827,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
828827 }
829828 index_key .desc_len = strlen (index_key .description );
830829
831- ret = __key_link_begin (keyring , & index_key , & prealloc );
830+ ret = __key_link_begin (keyring , & index_key , & edit );
832831 if (ret < 0 ) {
833832 key_ref = ERR_PTR (ret );
834833 goto error_free_prep ;
@@ -847,8 +846,8 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
847846 * update that instead if possible
848847 */
849848 if (index_key .type -> update ) {
850- key_ref = __keyring_search_one (keyring_ref , & index_key );
851- if (! IS_ERR ( key_ref ) )
849+ key_ref = find_key_to_update (keyring_ref , & index_key );
850+ if (key_ref )
852851 goto found_matching_key ;
853852 }
854853
@@ -874,7 +873,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
874873 }
875874
876875 /* instantiate it and link it into the target keyring */
877- ret = __key_instantiate_and_link (key , & prep , keyring , NULL , & prealloc );
876+ ret = __key_instantiate_and_link (key , & prep , keyring , NULL , & edit );
878877 if (ret < 0 ) {
879878 key_put (key );
880879 key_ref = ERR_PTR (ret );
@@ -884,7 +883,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
884883 key_ref = make_key_ref (key , is_key_possessed (keyring_ref ));
885884
886885error_link_end :
887- __key_link_end (keyring , & index_key , prealloc );
886+ __key_link_end (keyring , & index_key , edit );
888887error_free_prep :
889888 if (index_key .type -> preparse )
890889 index_key .type -> free_preparse (& prep );
@@ -897,7 +896,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
897896 /* we found a matching key, so we're going to try to update it
898897 * - we can drop the locks first as we have the key pinned
899898 */
900- __key_link_end (keyring , & index_key , prealloc );
899+ __key_link_end (keyring , & index_key , edit );
901900
902901 key_ref = __key_update (key_ref , & prep );
903902 goto error_free_prep ;
0 commit comments