sh: Fix access to released memory in dwarf_unwinder_cleanup()
authorMarek Skuczynski <mareksk7@gmail.com>
Sat, 30 Jan 2010 21:27:41 +0000 (22:27 +0100)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 2 Feb 2010 02:32:22 +0000 (11:32 +0900)
Signed-off-by: Marek Skuczynski <mareksk7@gmail.com>
Acked-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/dwarf.c

index 3576b709f052a2ec0e40e6ceb7472dd19e3643bf..88d28ec3780a621ecfcb4dba2ea9f670fda86f3a 100644 (file)
@@ -892,18 +892,18 @@ static struct unwinder dwarf_unwinder = {
 
 static void dwarf_unwinder_cleanup(void)
 {
-       struct dwarf_cie *cie;
-       struct dwarf_fde *fde;
+       struct dwarf_cie *cie, *cie_tmp;
+       struct dwarf_fde *fde, *fde_tmp;
 
        /*
         * Deallocate all the memory allocated for the DWARF unwinder.
         * Traverse all the FDE/CIE lists and remove and free all the
         * memory associated with those data structures.
         */
-       list_for_each_entry(cie, &dwarf_cie_list, link)
+       list_for_each_entry_safe(cie, cie_tmp, &dwarf_cie_list, link)
                kfree(cie);
 
-       list_for_each_entry(fde, &dwarf_fde_list, link)
+       list_for_each_entry_safe(fde, fde_tmp, &dwarf_fde_list, link)
                kfree(fde);
 
        kmem_cache_destroy(dwarf_reg_cachep);