Re: [PATCH 1/1] media: Set entity->links NULL in cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Laurent,

Oops. this got buried in my inbox...

Laurent Pinchart wrote:
On Thursday 17 July 2014 14:53:49 Sakari Ailus wrote:
On Thu, Jul 17, 2014 at 01:43:09PM +0200, Laurent Pinchart wrote:
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 ? :-)

Because it makes error handling easier. Many cleanup functions work this
way, but not media_entity_cleanup().

Do the cleanup functions support being called multiple times, or do they just
support being called on memory that has been zeroed and not further
initialized ? The media_entity_cleanup() function supports the latter.

I'd hope they wouldn't be called multiple times, or on memory that's not been zeroed, but in that case it's better to behave rather than corrupt system memory. That could be an indication of other problems, too, so one could consider adding WARN_ON() to this as well. What do you think?

--
Kind regards,

Sakari Ailus
sakari.ailus@xxxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux