Patch "scripts/kallsyms: fix definitely-lost memory leak" has been added to the 5.4-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    scripts/kallsyms: fix definitely-lost memory leak

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scripts-kallsyms-fix-definitely-lost-memory-leak.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fabf718d805277f1e3cd4d5327a8949ded938ece
Author: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
Date:   Sun Nov 24 01:04:30 2019 +0900

    scripts/kallsyms: fix definitely-lost memory leak
    
    [ Upstream commit 21915eca088dc271c970e8351290e83d938114ac ]
    
    build_initial_tok_table() overwrites unused sym_entry to shrink the
    table size. Before the entry is overwritten, table[i].sym must be freed
    since it is malloc'ed data.
    
    This fixes the 'definitely lost' report from valgrind. I ran valgrind
    against x86_64_defconfig of v5.4-rc8 kernel, and here is the summary:
    
    [Before the fix]
    
      LEAK SUMMARY:
         definitely lost: 53,184 bytes in 2,874 blocks
    
    [After the fix]
    
      LEAK SUMMARY:
         definitely lost: 0 bytes in 0 blocks
    
    Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index ae6504d07fd6..fb15f09e0e38 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -489,6 +489,8 @@ static void build_initial_tok_table(void)
 				table[pos] = table[i];
 			learn_symbol(table[pos].sym, table[pos].len);
 			pos++;
+		} else {
+			free(table[i].sym);
 		}
 	}
 	table_cnt = pos;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux