KEYS: trusted: return -EEXIST when refusing to update existing key
Subsystems (3)
James Bottomley
maintainerPATCH 1/1 KEYS: trusted: return -EEXIST when refusing to update existing key
All other key types return -EEXIST when refusing to update an existing key, but trusted keys return -EINVAL, which is confusing to users who can't figure out what the invalid argument is. Fix by returning -EEXIST if the key exists and we can't update it.
Fixes d00a1c72f7f4 ("keys: add new trusted key-type")
Signed-off-by James Bottomley <[email protected]>
Reviewed-by Mimi Zohar <[email protected]>
--- security/keys/trusted-keys/trusted_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted-keys/trusted_core.c +1 -1
@@ -254,7 +254,7 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep) datablob[datalen] ='\0' ; ret =datablob_parse (&datablob, new_p);if (ret != Opt_update) { - ret = -EINVAL ; + ret = -EEXIST ;kfree_sensitive (new_p); goto out; }
Signature · 1 line
2.35.3