Skip to content
  • Joel Becker's avatar
    [PATCH] configfs: Pin configfs subsystems separately from new config_items. · 70526b67
    Joel Becker authored
    
    
    configfs_mkdir() creates a new item by calling its parent's
    ->make_item/group() functions.  Once that object is created,
    configfs_mkdir() calls try_module_get() on the new item's module.  If it
    succeeds, the module owning the new item cannot be unloaded, and
    configfs is safe to reference the item.
    
    If the item and the subsystem it belongs to are part of the same module,
    the subsystem is also pinned.  This is the common case.
    
    However, if the subsystem is made up of multiple modules, this may not
    pin the subsystem.  Thus, it would be possible to unload the toplevel
    subsystem module while there is still a child item.  Thus, we now
    try_module_get() the subsystem's module.  This only really affects
    children of the toplevel subsystem group.  Deeper children already have
    their parents pinned.
    
    Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
    Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    70526b67