keys: Fix overwrite of key expiration on instantiation
Subsystems (7)
PATCH 1/1 keys: Fix overwrite of key expiration on instantiation
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.
--- security/keys/key.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/keys/key.c +2 -1
@@ -463,7 +463,8 @@ static int __key_instantiate_and_link(struct key *key,if (authkey)key_invalidate (authkey); -key_set_expiry (key, prep->expiry); +if (prep->expiry !=TIME64_MAX ) +key_set_expiry (key, prep->expiry); } }
Signature · 1 line
2.34.1
Quoted 25 lines · Silvio Gissi
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 thatkey_set_expiryis only called when the pre-parser sets a specific expiry.Fixes 39299bdd2546 ("keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry")Signed-off-by Silvio Gissi <[email protected]>cc David Howells <[email protected]>cc Hazem Mohamed Abuelfotoh <[email protected]>--- security/keys/key.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)security/keys/key.c +0
-0
security/keys/key.c static int __key_instantiate_and_link(struct key *key, · line 470
Quoted 9 lines
security/keys/key.c +2
-1@@ -463,7 +463,8 @@ static int __key_instantiate_and_link(struct key *key,if (authkey)key_invalidate (authkey); -key_set_expiry (key, prep->expiry); +if (prep->expiry !=TIME64_MAX ) +key_set_expiry (key, prep->expiry); } }
I checked the original commit and reflected to the fix:
David, I can pick this one too as I'm anyway sending PR for rc2?
[1] https://lore.kernel.org/keyrings/[email protected]/
BR, Jarkko
Jarkko Sakkinen
maintainerQuoted 38 lines · Jarkko Sakkinen
Quoted 25 lines · Silvio Gissi
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 thatkey_set_expiryis only called when the pre-parser sets a specific expiry.Fixes 39299bdd2546 ("keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry")Signed-off-by Silvio Gissi <[email protected]>cc David Howells <[email protected]>cc Hazem Mohamed Abuelfotoh <[email protected]>--- security/keys/key.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)security/keys/key.c +0
-0security/keys/key.c static int __key_instantiate_and_link(struct key *key, · line 470
Quoted 9 lines
security/keys/key.c +2
-1@@ -463,7 +463,8 @@ static int __key_instantiate_and_link(struct key *key,if (authkey)key_invalidate (authkey); -key_set_expiry (key, prep->expiry); +if (prep->expiry !=TIME64_MAX ) +key_set_expiry (key, prep->expiry); } }I checked the original commit and reflected to the fix:
Quoted 5 lines
Reviewed-by Jarkko Sakkinen <[email protected]>David, I can pick this one too as I'm anyway sending PR for rc2?
I've applied this to my tree. Can drop on request but otherwise including to rc2 PR.
BR, Jarkko