Skip to contentSkip to conversation

netfs: use kfree_sensitive() instend of kfree() in fscache_free_cookie()

PATCH In review Minjie Du 2 participants 2 messages Jan 8, 2024

Subsystems (2)
lore
Share & tools
lore

Minjie Du

author
#0 lore raw

PATCH 1/1 netfs: use kfree_sensitive() instend of kfree() in fscache_free_cookie()

key might contain private information, so use kfree_sensitive to free it. In fscache_free_cookie() use kfree_sensitive().

---
 fs/netfs/fscache_cookie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/netfs/fscache_cookie.c +1 -1
index bce2492186d0..5c917d87f281 100644
@@ -74,7 +74,7 @@ static void fscache_free_cookie(struct fscache_cookie *cookie)
 	if (cookie->aux_len > sizeof(cookie->inline_aux))
 		kfree(cookie->aux);
 	if (cookie->key_len > sizeof(cookie->inline_key))
-		kfree(cookie->key);
+		kfree_sensitive(cookie->key);
 	fscache_stat_d(&fscache_n_cookies);
 	kmem_cache_free(fscache_cookie_jar, cookie);
 }
Signature · 1 line
2.39.0
maintainer
#1 lore raw
Quoted 3 lines · Minjie Du

[email protected] (moderated
list:FILESYSTEMS [NETFS LIBRARY]), [email protected] (open list:FILESYSTEMS [NETFS LIBRARY]), [email protected] (open list)

In future, could you edit the comments out of the email addresses, please?

Quoted 2 lines

key might contain private information, so use kfree_sensitive to free it. In fscache_free_cookie() use kfree_sensitive().

There's no real point. These are written as filenames (possibly base64-ish encoded) on disk by cachefiles and represent the information given to the server to indicate the file (in afs, for example, that's cell name, volume name, vnode number).

David