• Michał Mirosław's avatar
    regulator: push allocations in create_regulator() outside of lock · 87fe29b6
    Michał Mirosław authored
    Move all allocations outside of the regulator_lock()ed section.
    
    ======================================================
    WARNING: possible circular locking dependency detected
    5.7.13+ #535 Not tainted
    ------------------------------------------------------
    f2fs_discard-179:7/702 is trying to acquire lock:
    c0e5d920 (regulator_list_mutex){+.+.}-{3:3}, at: regulator_lock_dependent+0x54/0x2c0
    
    but task is already holding lock:
    cb95b080 (&dcc->cmd_lock){+.+.}-{3:3}, at: __issue_discard_cmd+0xec/0x5f8
    
    which lock already depends on the new lock.
    
    the existing dependency chain (in reverse order) is:
    
    [...]
    
    -> #3 (fs_reclaim){+.+.}-{0:0}:
           fs_reclaim_acquire.part.11+0x40/0x50
           fs_reclaim_acquire+0x24/0x28
           __kmalloc_track_caller+0x54/0x218
           kstrdup+0x40/0x5c
           create_regulator+0xf4/0x368
           regulator_resolve_supply+0x1a0/0x200
           regulator_register+0x9c8/0x163c
    
    [...]
    
    other info that might help us debug this:
    
    Chain exists of:
      regulator_list_mutex --> &sit_i->sentry_lock --> &dcc->cmd_lock
    
    [...]
    
    Fixes: f8702f9e ("regulator: core: Use ww_mutex for regulators locking")
    Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/6eebc99b2474f4ffaa0405b15178ece0e7e4f608.1597195321.git.mirq-linux@rere.qmqm.plSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    87fe29b6
core.c 150 KB