From 9ab93530884e885c6295df07635f33467c4dd228 Mon Sep 17 00:00:00 2001 From: David Howells Date: Sat, 25 Mar 2006 03:06:52 -0800 Subject: [PATCH] --- yaml --- r: 23517 b: refs/heads/master c: 1d9b7d97d6661edb44ce08f17e47c66d4ac20e34 h: refs/heads/master i: 23515: 8ed639c0210070569648dde8a86f8d884139bde4 v: v3 --- [refs] | 2 +- trunk/security/keys/key.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 2c44827e51d3..4378e5eb8b5d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3dccff8dc00994428777f483922058c554db85bd +refs/heads/master: 1d9b7d97d6661edb44ce08f17e47c66d4ac20e34 diff --git a/trunk/security/keys/key.c b/trunk/security/keys/key.c index 627697181e6a..a057e3311aad 100644 --- a/trunk/security/keys/key.c +++ b/trunk/security/keys/key.c @@ -795,12 +795,16 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, goto error_3; } - /* search for an existing key of the same type and description in the - * destination keyring + /* if it's possible to update this type of key, search for an existing + * key of the same type and description in the destination keyring and + * update that instead if possible */ - key_ref = __keyring_search_one(keyring_ref, ktype, description, 0); - if (!IS_ERR(key_ref)) - goto found_matching_key; + if (ktype->update) { + key_ref = __keyring_search_one(keyring_ref, ktype, description, + 0); + if (!IS_ERR(key_ref)) + goto found_matching_key; + } /* decide on the permissions we want */ perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR;