From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/1] media: Set entity->links NULL in cleanup
Date: Thu, 17 Jul 2014 13:43:09 +0200 [thread overview]
Message-ID: <3533594.Ac4LJj8QGP@avalon> (raw)
In-Reply-To: <1401197269-18773-1-git-send-email-sakari.ailus@linux.intel.com>
Hi Sakari,
Thank you for the patch.
On Tuesday 27 May 2014 16:27:49 Sakari Ailus wrote:
> Calling media_entity_cleanup() on a cleaned-up entity would result into
> double free of the entity->links pointer and likely memory corruption as
> well.
My first question is, why would anyone do that ? :-)
> Setting entity->links as NULL right after the kfree() avoids this.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> drivers/media/media-entity.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 37c334e..c404354 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -83,6 +83,7 @@ void
> media_entity_cleanup(struct media_entity *entity)
> {
> kfree(entity->links);
> + entity->links = NULL;
> }
> EXPORT_SYMBOL_GPL(media_entity_cleanup);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-07-17 11:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 13:27 [PATCH 1/1] media: Set entity->links NULL in cleanup Sakari Ailus
2014-07-17 11:43 ` Laurent Pinchart [this message]
2014-07-17 11:53 ` Sakari Ailus
2014-07-17 12:13 ` Laurent Pinchart
2014-09-24 9:17 ` Sakari Ailus
2014-09-26 14:20 ` Laurent Pinchart
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=3533594.Ac4LJj8QGP@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.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).