linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] keys/keyctl: Use kfree_rcu instead of kfree
@ 2022-07-23 13:50 Siddh Raman Pant via Linux-kernel-mentees
  2022-07-23 14:05 ` Greg KH
  2022-07-28  8:11 ` Jarkko Sakkinen
  0 siblings, 2 replies; 8+ messages in thread
From: Siddh Raman Pant via Linux-kernel-mentees @ 2022-07-23 13:50 UTC (permalink / raw)
  To: David Howells, Jarkko Sakkinen, James Morris, Serge E. Hallyn
  Cc: linux-security-modules, keyrings, linux-kernel-mentees, linux-kernel

In keyctl_watch_key, use kfree_rcu() for freeing watch and wlist
as they support RCU and have an rcu_head in the struct definition.

Signed-off-by: Siddh Raman Pant <code@siddh.me>
---
 security/keys/keyctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 96a92a645216..087fbc141cfd 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1832,9 +1832,9 @@ long keyctl_watch_key(key_serial_t id, int watch_queue_fd, int watch_id)
 	}
 
 err_watch:
-	kfree(watch);
+	kfree_rcu(watch, rcu);
 err_wlist:
-	kfree(wlist);
+	kfree_rcu(wlist, rcu);
 err_wqueue:
 	put_watch_queue(wqueue);
 err_key:
-- 
2.35.1


_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-28  8:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-23 13:50 [PATCH] keys/keyctl: Use kfree_rcu instead of kfree Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:05 ` Greg KH
2022-07-23 14:35   ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:43     ` Greg KH
2022-07-23 15:28       ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:50     ` James Bottomley
2022-07-23 15:28       ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-28  8:11 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).