[PATCH] Fix kfree usage in various mtd map remove functions

MikeW mw_phil at yahoo.co.uk
Mon May 21 11:44:28 EDT 2007


Phil Endecott <spam_from_linux_mtd <at> chezphil.org> writes:

> 
> The remove() functions in various mtd map drivers were incorrectly kfree()ing
the struct 
> resource that they had passed to release_resource(), and/or failing to free
the *_flash_info 
> structure.  This looks like a typo which has gradually propogated by
copy&paste into a number 
> of these drivers.
> 
> Since mtd drivers are rarely or never used as modules (they typically provide
root filesystems) 
> it is unlikely that these code paths have ever been exercised.  It also means
that this patch 
> has not been tested by the author.
> 
> This patch is against 2.6.21.
> 
> Signed-off-by: Phil Endecott <spam_from_linux_mtd_patch <at> chezphil.org>
> 

Good chap !!

They could be tested by building as modules then insmod/rmmod-ing
repeatedly, whilst observing kernel memory usage, before and after fix.

Regards,
MikeW





More information about the linux-mtd mailing list