hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/security/keys/gc.c
....@@ -1,15 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* Key garbage collector
23 *
34 * Copyright (C) 2009-2011 Red Hat, Inc. All Rights Reserved.
45 * Written by David Howells (dhowells@redhat.com)
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public Licence
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the Licence, or (at your option) any later version.
106 */
117
12
-#include <linux/module.h>
138 #include <linux/slab.h>
149 #include <linux/security.h>
1510 #include <keys/keyring-type.h>
....@@ -136,6 +131,11 @@
136131 kdebug("- %u", key->serial);
137132 key_check(key);
138133
134
+#ifdef CONFIG_KEY_NOTIFICATIONS
135
+ remove_watch_list(key->watchers, key->serial);
136
+ key->watchers = NULL;
137
+#endif
138
+
139139 /* Throw away the key data if the key is instantiated */
140140 if (state == KEY_IS_POSITIVE && key->type->destroy)
141141 key->type->destroy(key);
....@@ -155,7 +155,7 @@
155155 atomic_dec(&key->user->nikeys);
156156
157157 key_user_put(key->user);
158
-
158
+ key_put_tag(key->domain_tag);
159159 kfree(key->description);
160160
161161 memzero_explicit(key, sizeof(*key));