summaryrefslogtreecommitdiff
path: root/security/keys/key.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2025-07-09 11:51:34 +0200
committerThomas Gleixner <tglx@linutronix.de>2025-07-09 11:51:34 +0200
commit068f7b64bf2054e20bbbd0782aa11f6ff8d17105 (patch)
treef9f88dfe79f4be4789480dc22f74908b3484a8f8 /security/keys/key.c
parent8959338617a85e35820e3a7fa21801cf55b068bf (diff)
parente04c78d86a9699d136910cfc0bdcf01087e3267e (diff)
Merge v6.16-rc2 into timers/ptp
to pick up the __GENMASK() fix, otherwise the AUX clock VDSO patches fail to compile for compat. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'security/keys/key.c')
-rw-r--r--security/keys/key.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/security/keys/key.c b/security/keys/key.c
index 7198cd2ac3a3..3bbdde778631 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -298,6 +298,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
key->restrict_link = restrict_link;
key->last_used_at = ktime_get_real_seconds();
+ key->flags |= 1 << KEY_FLAG_USER_ALIVE;
if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
key->flags |= 1 << KEY_FLAG_IN_QUOTA;
if (flags & KEY_ALLOC_BUILT_IN)
@@ -658,8 +659,8 @@ void key_put(struct key *key)
key->user->qnbytes -= key->quotalen;
spin_unlock_irqrestore(&key->user->lock, flags);
}
- smp_mb(); /* key->user before FINAL_PUT set. */
- set_bit(KEY_FLAG_FINAL_PUT, &key->flags);
+ /* Mark key as safe for GC after key->user done. */
+ clear_bit_unlock(KEY_FLAG_USER_ALIVE, &key->flags);
schedule_work(&key_gc_work);
}
}