From: Jarkko Sakkinen <jarkko@kernel.org>
To: Siddh Raman Pant <code@siddh.me>
Cc: David Howells <dhowells@redhat.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
keyrings <keyrings@vger.kernel.org>,
linux-security-modules <linux-security-module@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-kernel-mentees
<linux-kernel-mentees@lists.linuxfoundation.org>
Subject: Re: [PATCH] keys/keyctl: Use kfree_rcu instead of kfree
Date: Thu, 28 Jul 2022 11:11:15 +0300 [thread overview]
Message-ID: <YuJEozyceOKQ63/6@kernel.org> (raw)
In-Reply-To: <20220723135035.199188-1-code@siddh.me>
On Sat, Jul 23, 2022 at 07:20:35PM +0530, Siddh Raman Pant wrote:
> 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>
Applies to any patch: the commit message should *clearly* describe
1. What is wrong in the current code *behaviour*.
2. Why does the code change save the day.
> ---
> 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
>
>
BR, Jarkko
WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Siddh Raman Pant <code@siddh.me>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
James Morris <jmorris@namei.org>,
David Howells <dhowells@redhat.com>,
linux-security-modules <linux-security-module@vger.kernel.org>,
keyrings <keyrings@vger.kernel.org>,
linux-kernel-mentees
<linux-kernel-mentees@lists.linuxfoundation.org>,
"Serge E. Hallyn" <serge@hallyn.com>
Subject: Re: [PATCH] keys/keyctl: Use kfree_rcu instead of kfree
Date: Thu, 28 Jul 2022 11:11:15 +0300 [thread overview]
Message-ID: <YuJEozyceOKQ63/6@kernel.org> (raw)
In-Reply-To: <20220723135035.199188-1-code@siddh.me>
On Sat, Jul 23, 2022 at 07:20:35PM +0530, Siddh Raman Pant wrote:
> 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>
Applies to any patch: the commit message should *clearly* describe
1. What is wrong in the current code *behaviour*.
2. Why does the code change save the day.
> ---
> 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
>
>
BR, Jarkko
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2022-07-28 8:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-23 13:50 [PATCH] keys/keyctl: Use kfree_rcu instead of kfree Siddh Raman Pant
2022-07-23 13:50 ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:05 ` Greg KH
2022-07-23 14:05 ` Greg KH
2022-07-23 14:35 ` Siddh Raman Pant
2022-07-23 14:35 ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:43 ` Greg KH
2022-07-23 14:43 ` Greg KH
2022-07-23 15:28 ` Siddh Raman Pant
2022-07-23 15:28 ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-23 14:50 ` James Bottomley
2022-07-23 14:50 ` James Bottomley
2022-07-23 15:28 ` Siddh Raman Pant
2022-07-23 15:28 ` Siddh Raman Pant via Linux-kernel-mentees
2022-07-28 8:11 ` Jarkko Sakkinen [this message]
2022-07-28 8:11 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YuJEozyceOKQ63/6@kernel.org \
--to=jarkko@kernel.org \
--cc=code@siddh.me \
--cc=dhowells@redhat.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.