@@ -409,7 +409,7 @@ static int __key_instantiate_and_link(struct key *key,
409
409
struct key_preparsed_payload * prep ,
410
410
struct key * keyring ,
411
411
struct key * authkey ,
412
- unsigned long * _prealloc )
412
+ struct assoc_array_edit * * _edit )
413
413
{
414
414
int ret , awaken ;
415
415
@@ -436,7 +436,7 @@ static int __key_instantiate_and_link(struct key *key,
436
436
437
437
/* and link it into the destination keyring */
438
438
if (keyring )
439
- __key_link (keyring , key , _prealloc );
439
+ __key_link (key , _edit );
440
440
441
441
/* disable the authorisation key */
442
442
if (authkey )
@@ -476,7 +476,7 @@ int key_instantiate_and_link(struct key *key,
476
476
struct key * authkey )
477
477
{
478
478
struct key_preparsed_payload prep ;
479
- unsigned long prealloc ;
479
+ struct assoc_array_edit * edit ;
480
480
int ret ;
481
481
482
482
memset (& prep , 0 , sizeof (prep ));
@@ -490,16 +490,15 @@ int key_instantiate_and_link(struct key *key,
490
490
}
491
491
492
492
if (keyring ) {
493
- ret = __key_link_begin (keyring , & key -> index_key , & prealloc );
493
+ ret = __key_link_begin (keyring , & key -> index_key , & edit );
494
494
if (ret < 0 )
495
495
goto error_free_preparse ;
496
496
}
497
497
498
- ret = __key_instantiate_and_link (key , & prep , keyring , authkey ,
499
- & prealloc );
498
+ ret = __key_instantiate_and_link (key , & prep , keyring , authkey , & edit );
500
499
501
500
if (keyring )
502
- __key_link_end (keyring , & key -> index_key , prealloc );
501
+ __key_link_end (keyring , & key -> index_key , edit );
503
502
504
503
error_free_preparse :
505
504
if (key -> type -> preparse )
@@ -537,7 +536,7 @@ int key_reject_and_link(struct key *key,
537
536
struct key * keyring ,
538
537
struct key * authkey )
539
538
{
540
- unsigned long prealloc ;
539
+ struct assoc_array_edit * edit ;
541
540
struct timespec now ;
542
541
int ret , awaken , link_ret = 0 ;
543
542
@@ -548,7 +547,7 @@ int key_reject_and_link(struct key *key,
548
547
ret = - EBUSY ;
549
548
550
549
if (keyring )
551
- link_ret = __key_link_begin (keyring , & key -> index_key , & prealloc );
550
+ link_ret = __key_link_begin (keyring , & key -> index_key , & edit );
552
551
553
552
mutex_lock (& key_construction_mutex );
554
553
@@ -570,7 +569,7 @@ int key_reject_and_link(struct key *key,
570
569
571
570
/* and link it into the destination keyring */
572
571
if (keyring && link_ret == 0 )
573
- __key_link (keyring , key , & prealloc );
572
+ __key_link (key , & edit );
574
573
575
574
/* disable the authorisation key */
576
575
if (authkey )
@@ -580,7 +579,7 @@ int key_reject_and_link(struct key *key,
580
579
mutex_unlock (& key_construction_mutex );
581
580
582
581
if (keyring )
583
- __key_link_end (keyring , & key -> index_key , prealloc );
582
+ __key_link_end (keyring , & key -> index_key , edit );
584
583
585
584
/* wake up anyone waiting for a key to be constructed */
586
585
if (awaken )
@@ -783,8 +782,8 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
783
782
.description = description ,
784
783
};
785
784
struct key_preparsed_payload prep ;
785
+ struct assoc_array_edit * edit ;
786
786
const struct cred * cred = current_cred ();
787
- unsigned long prealloc ;
788
787
struct key * keyring , * key = NULL ;
789
788
key_ref_t key_ref ;
790
789
int ret ;
@@ -828,7 +827,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
828
827
}
829
828
index_key .desc_len = strlen (index_key .description );
830
829
831
- ret = __key_link_begin (keyring , & index_key , & prealloc );
830
+ ret = __key_link_begin (keyring , & index_key , & edit );
832
831
if (ret < 0 ) {
833
832
key_ref = ERR_PTR (ret );
834
833
goto error_free_prep ;
@@ -847,8 +846,8 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
847
846
* update that instead if possible
848
847
*/
849
848
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 )
852
851
goto found_matching_key ;
853
852
}
854
853
@@ -874,7 +873,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
874
873
}
875
874
876
875
/* 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 );
878
877
if (ret < 0 ) {
879
878
key_put (key );
880
879
key_ref = ERR_PTR (ret );
@@ -884,7 +883,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
884
883
key_ref = make_key_ref (key , is_key_possessed (keyring_ref ));
885
884
886
885
error_link_end :
887
- __key_link_end (keyring , & index_key , prealloc );
886
+ __key_link_end (keyring , & index_key , edit );
888
887
error_free_prep :
889
888
if (index_key .type -> preparse )
890
889
index_key .type -> free_preparse (& prep );
@@ -897,7 +896,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
897
896
/* we found a matching key, so we're going to try to update it
898
897
* - we can drop the locks first as we have the key pinned
899
898
*/
900
- __key_link_end (keyring , & index_key , prealloc );
899
+ __key_link_end (keyring , & index_key , edit );
901
900
902
901
key_ref = __key_update (key_ref , & prep );
903
902
goto error_free_prep ;
0 commit comments