Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • kernel
  • module.c
Find file BlameHistoryPermalink
  • Steven Rostedt (Red Hat)'s avatar
    ftrace/module: Call clean up function when module init fails early · 2d6a0dc1
    Steven Rostedt (Red Hat) authored Jan 05, 2016
    commit 049fb9bd upstream.
    
    If the module init code fails after calling ftrace_module_init() and before
    calling do_init_module(), we can suffer from a memory leak. This is because
    ftrace_module_init() allocates pages to store the locations that ftrace
    hooks are placed in the module text. If do_init_module() fails, it still
    calls the MODULE_GOING notifiers which will tell ftrace to do a clean up of
    the pages it allocated for the module. But if load_module() fails before
    then, the pages allocated by ftrace_module_init() will never be freed.
    
    Call ftrace_release_mod() on the module if load_module() fails before
    getting to do_init_module().
    
    Link: http://lkml.kernel.org/r/567CEA31.1070507@intel.com
    
    
    
    Reported-by: default avatar"Qiu, PeiyangX" <peiyangx.qiu@intel.com>
    Fixes: a949ae56
    
     "ftrace/module: Hardcode ftrace_module_init() call into load_module()"
    Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    [ luis: backported to 3.16: adjusted context ]
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
    2d6a0dc1
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7