Skip to content

Commit cc219cb

Browse files
Silvio Gissigregkh
authored andcommitted
keys: Fix overwrite of key expiration on instantiation
commit 9da27fb upstream. The expiry time of a key is unconditionally overwritten during instantiation, defaulting to turn it permanent. This causes a problem for DNS resolution as the expiration set by user-space is overwritten to TIME64_MAX, disabling further DNS updates. Fix this by restoring the condition that key_set_expiry is only called when the pre-parser sets a specific expiry. Fixes: 39299bd ("keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry") Signed-off-by: Silvio Gissi <sifonsec@amazon.com> cc: David Howells <dhowells@redhat.com> cc: Hazem Mohamed Abuelfotoh <abuehaze@amazon.com> cc: linux-afs@lists.infradead.org cc: linux-cifs@vger.kernel.org cc: keyrings@vger.kernel.org cc: netdev@vger.kernel.org cc: stable@vger.kernel.org Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 21a8f1c commit cc219cb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

security/keys/key.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ static int __key_instantiate_and_link(struct key *key,
463463
if (authkey)
464464
key_invalidate(authkey);
465465

466-
key_set_expiry(key, prep->expiry);
466+
if (prep->expiry != TIME64_MAX)
467+
key_set_expiry(key, prep->expiry);
467468
}
468469
}
469470

0 commit comments

Comments
 (0)