From: Corey Minyard <minyard@acm.org>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] char:ipmi: Free ipmi_recv_msg messages from the linked list,recv_msgs for the function,ipmi_release in the file,ipmi_devintf.c
Date: Thu, 22 Jan 2015 07:05:31 -0600 [thread overview]
Message-ID: <54C0F59B.8090709@acm.org> (raw)
In-Reply-To: <1421723653-19633-1-git-send-email-xerofoify@gmail.com>
Patch is queued for 3.20. Thanks.
-corey
On 01/19/2015 09:14 PM, Nicholas Krause wrote:
> This adds a loop through the elements in the linked list, recv_msgs using
> list_for_entry_safe in order to free messages in this list. In addition
> we are using the safe version of this marco in order to prevent use after
> bugs related to deleting the element we are on currently by holding a
> pointer to the next element after the current one we are on and freeing
> with the function, ipmi_free_recv_msg internally in this loop.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> drivers/char/ipmi/ipmi_devintf.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
> index ec318bf..d2af38a 100644
> --- a/drivers/char/ipmi/ipmi_devintf.c
> +++ b/drivers/char/ipmi/ipmi_devintf.c
> @@ -157,14 +157,15 @@ static int ipmi_release(struct inode *inode, struct file *file)
> {
> struct ipmi_file_private *priv = file->private_data;
> int rv;
> + struct ipmi_recv_msg *msg, *next;
>
> rv = ipmi_destroy_user(priv->user);
> if (rv)
> return rv;
>
> - /* FIXME - free the messages in the list. */
> - kfree(priv);
> -
> + list_for_each_entry_safe(msg, next, &priv->recv_msgs, link) {
> + ipmi_free_recv_msg(msg);
> + }
> return 0;
> }
>
next parent reply other threads:[~2015-01-22 13:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1421723653-19633-1-git-send-email-xerofoify@gmail.com>
2015-01-22 13:05 ` Corey Minyard [this message]
2015-01-23 4:50 ` [PATCH RESEND] char:ipmi: Free ipmi_recv_msg messages from the linked list,recv_msgs for the function,ipmi_release in the file,ipmi_devintf.c Sasha Levin
2015-01-23 4:50 ` Sasha Levin
[not found] ` <54C27857.8030203@gmail.com>
2015-01-23 17:07 ` Corey Minyard
[not found] <1422681474-18915-1-git-send-email-xerofoify@gmail.com>
2015-02-04 20:17 ` Corey Minyard
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=54C0F59B.8090709@acm.org \
--to=minyard@acm.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=xerofoify@gmail.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 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).