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
You need to sign in or sign up before continuing.
  • linux
  • kernel
  • module.c
Find file BlameHistoryPermalink
  • Konstantin Khorenko's avatar
    kernel/module.c: wakeup processes in module_wq on module unload · 12c88d91
    Konstantin Khorenko authored Nov 13, 2019
    [ Upstream commit 5d603311 ]
    
    Fix the race between load and unload a kernel module.
    
    sys_delete_module()
     try_stop_module()
      mod->state = _GOING
    					add_unformed_module()
    					 old = find_module_all()
    					 (old->state == _GOING =>
    					  wait_event_interruptible())
    
    					 During pre-condition
    					 finished_loading() rets 0
    					 schedule()
    					 (never gets waken up later)
     free_module()
      mod->state = _UNFORMED
       list_del_rcu(&mod->list)
       (dels mod from "modules" list)
    
    return
    
    The race above leads to modprobe hanging forever on loading
    a module.
    
    Error paths on loading module call wake_up_all(&module_wq) after
    freeing module, so let's do the same on straight module unload.
    
    Fixes: 6e6de3de
    
     ("kernel/module.c: Only return -EEXIST for modules that have finished loading")
    Reviewed-by: default avatarPrarit Bhargava <prarit@redhat.com>
    Signed-off-by: default avatarKonstantin Khorenko <khorenko@virtuozzo.com>
    Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    12c88d91
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7